This is not a "valid" question! The reason is that the calendar has been changed several times during the change of time and thus you must compensate by altering the calender and the change date is also different depending upon country and such.
On the last calenderchange from Julian to Gregorian there were removed 10 days due to the skew in the calender. This applied to the countries changing at that wery time, othaer that changed at a later day had to compensate more days.
So it's not possible to answer the question as the week might not even have 7 days in those days.
So there is really no answer to that question.
I do have a calender calculating routine (in C):
/*****************************************
* Calender.h *
* Time & date calculations *
* (C) Icecap 2005-02-11 *
* All calculations is based on Gregorian calender & ISO notation *
*****************************************/
enum {_Monday = 1, _Tuesday, _Wednesday, _Thursday, _Friday, _Saturday,_Sunday} Weekdays;
enum {_JANUARY = 1,_FEBUARY,_MARCH,_APRIL,_MAY,_JUNE,_JULY,_AUGUST,_SEPTEMBER,_OCTOBER,_NOVEMBER,_DECEMBER};
const unsigned char _WEEK_Days_In_Month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
enum {Year_Outa_Range = 0x80,Month_Outa_Range,Date_Outa_Range} Date_Errors;
char isDTS(unsigned int year,unsigned char month,unsigned char date,unsigned char hour)
{
// Returns true when Daylight Time Saving (DTS) is valid
unsigned char x;
switch(month)
{
case _JANUARY:
case _FEBUARY:
case _MARCH:
case _NOVEMBER:
case _DECEMBER: return(0);
case _MAY:
case _JUNE:
case _JULY:
case _AUGUST:
case _SEPTEMBER: return(1);
case _APRIL: /* From first Sunday in April */
x = Day_Of_Week(year,_APRIL,1);
if((x > date) || ((x == date) && (hour > 2))) return(1);
else return(0);
case _OCTOBER: /* To last Sunday in October */
x = _WEEK_Days_In_Month[_OCTOBER] - (7 - Day_Of_Week(year,_OCTOBER,_WEEK_Days_In_Month[_OCTOBER]));
if((x < date) || ((x == date) && (hour < 2))) return(1);
else return(0);
}
return(0);
}
int Is_Leapyear(unsigned int year)
{
return(!((year % 100) & 3) && ((year % 100) || !((year / 100) & 3)));
}
unsigned char Invalid_Date(unsigned int year,unsigned char month,unsigned char date)
{
if((year < 1753) || (year > 9999)) return(Year_Outa_Range);
if((month < 1) || (month > 12)) return(Month_Outa_Range);
if((date < 1) || (date > (_WEEK_Days_In_Month[month] + ((month == 2) && Is_Leapyear(year))))) return(Date_Outa_Range);
return(false);
}
unsigned char Day_Of_Week(unsigned int year,unsigned char month,unsigned char date)
{ /* 1=Monday, 2=tuesday etc. as ISO declares */
int Result;
Result = Invalid_Date(year,month,date);
if(Result) return(Result);
if(month < 3)
{
month += 10;
year--;
}
else month -= 2;
Result = 2 + (((((26 * (int) month - 2) / 10) + (int) date + (year % 100) + ((year % 100) / 4) + ((year / 100) / 4) - (2 * (year / 100))) + 4));
while(Result < 0) Result += 7;
Result %= 7;
Result++; /* Make it go 1-7 in stead of 0-6 */
return(Result);
}
Totte
Keep making it perfect and it will end up broken.