Example #1
0
hdate_struct HDate::weekStartMonth(hdate_struct h)
{
        hdate_set_hdate (&h, 1, h.hd_mon, h.hd_year);
        int jd_current_month = h.hd_jd - h.hd_dw + 1;
        hdate_struct h1;
        hdate_set_jd (&h1, jd_current_month);
            return h1;
}
Example #2
0
/**
 @brief Return the day in the omer of the given date

 @param h The hdate_struct of the date to use.
 @return The day in the omer, starting from 1 (or 0 if not in sfirat ha omer)
*/
int
hdate_get_omer_day(hdate_struct const * h)
{
	int omer_day;
	hdate_struct sixteen_nissan;
	
	hdate_set_hdate(&sixteen_nissan, 16, 7, h->hd_year);
	omer_day = h->hd_jd - sixteen_nissan.hd_jd + 1;

	if ((omer_day > 49) || (omer_day < 0)) 
		omer_day = 0;

	return omer_day;
}
Example #3
0
hdate_struct HDate::nextMonth(hdate_struct h)
{
    int m =h.hd_mon;
    int y=h.hd_year;
    hdate_struct h_t;
    if(m==12){
        y=y+1;
        m=1;
    }else if(is_leap_year(y)&&m==5){
        m=13;
    }else if(m==13){
        m=14;
    }else if(m==14){
        m=7;
    }else{
        m=m+1;
    }
    hdate_set_hdate(&h_t,1,m,y);
    current_h=h_t;

    return(h_t);
}
Example #4
0
hdate_struct HDate::previousMonth(hdate_struct h)
{
   int  m =h.hd_mon;
   int  y=h.hd_year;
    hdate_struct h_t;
    if(m==1){
        y=y-1;
        m=12;
    }else if(is_leap_year(y)&&m==7){
        m=14;
    }else if(m==13){
        m=5;
    }else if(m==14){
        m=13;
    }else{
        m=m-1;
    }
    hdate_set_hdate(&h_t,1,m,y);
    current_h=h_t;

    return(h_t);
}
Example #5
0
hdate_struct HDate::setHebDate(int y, int m, int d)
{
    hdate_struct h;
    hdate_set_hdate (&h, d, m, y);
    return h;
}