RPi/weather/calendar.c
int weekNumber(int d,int m,int y)
{
int dow1Jan = dayOfWeek(1,1,y);
int firstMonday = 1;
    if(dow1Jan == 5 || dow1Jan == 6 || dow1Jan == 0) {
	for(;;) {
	    int dow = dayOfWeek(firstMonday,1,y);
	    if(dow == 1) break;
	    firstMonday++;
	}
    }
    int dy = dayOfYear(d,m,y);
    if(dy < firstMonday) return weekNumber(31,12,y-1);	//last week of previous year
    dy -= firstMonday;
    return dy / 7 + 1;
}
/*******************************************************************************/
// The ISO 8601 week number (see NOTES) of the current year as a
//  decimal number, range 01 to 53, where week 1 is the first week
//  that has at least 4 days in the new year.
// or, synonymously, week 01 is: the first week of the year that contains a Thursday;
// or, the week that has 4 January in it
The ISO 8601 week number  of the current year as a
decimal number, range 01 to 53, where week 1 is the first week
that has at least 4 days in the new year.
or, synonymously, week 01 is: the first week of the year that contains a Thursday;
or, the week that has 4 January in it
The ISO 8601 week number of the current year as a decimal number range 01 to 53 where week 1 is the first week that has at least 4 days in the new year . or synonymously week 01 is : the first week of the year that contains a Thursday ; or the week that has 4 January in it
int weekNumber(int d,int m,int y)
{
int dow1Jan = dayOfWeek(1,1,y);
int firstMonday = 1;
    if(dow1Jan == 5 || dow1Jan == 6 || dow1Jan == 0) {
	for(;;) {
	    int dow = dayOfWeek(firstMonday,1,y);
	    if(dow == 1) break;
	    firstMonday++;
	}
    }
    int dy = dayOfYear(d,m,y);
    if(dy < firstMonday) return weekNumber(31,12,y-1);	
    dy -= firstMonday;
    return dy / 7 + 1;
}
int weekNumber ( int d , int m , int y ) { int dow1Jan = dayOfWeek ( 1 , 1 , y ) ; int firstMonday = 1 ; if ( dow1Jan == 5 || dow1Jan == 6 || dow1Jan == 0 ) { for ( ; ; ) { int dow = dayOfWeek ( firstMonday , 1 , y ) ; if ( dow == 1 ) break ; firstMonday ++ ; } } int dy = dayOfYear ( d , m , y ) ; if ( dy < firstMonday ) return weekNumber ( 31 , 12 , y - 1 ) ; dy -= firstMonday ; return dy / 7 + 1 ; }
The ISO 8601 week number (see NOTES) of the current year as a
decimal number, range 01 to 53, where week 1 is the first week
that has at least 4 days in the new year.
The ISO 8601 week number ( see NOTES ) of the current year as a decimal number range 01 to 53 where week 1 is the first week that has at least 4 days in the new year .
//last week of previous year