hi.
i want to know which day we are on now. i mean today is sunday or monday or… ? is there any way to get this parameter?
int GetHaftaninGunu(adl_rtcTime_t * now)
{
int days;
adl_rtcTime_t belliGun; //04.01.09 00:00:00 sunday(0)
adl_rtcTimeStamp_t ts1,ts2,diff;
belliGun.Year=2009;
belliGun.Month=1;
belliGun.Day=4;
belliGun.Hour=0;
belliGun.Minute=0;
belliGun.Second=0;
adl_rtcConvertTime(&belliGun,&ts1,ADL_RTC_CONVERT_TO_TIMESTAMP);
adl_rtcConvertTime(now,&ts2,ADL_RTC_CONVERT_TO_TIMESTAMP);
if(adl_rtcDiffTime ( &ts2, &ts1, &diff )!=1)
return 0;
days = ADL_RTC_GET_TIMESTAMP_DAYS(diff);
return days%7;
}
i wrote this function for that. is there any built-in function or any other way for it?
Here’s some date & time stuff for your amusement: merlyn.demon.co.uk/datelinx.htm
Hiya,
And here’s an algorithm that I’ve used sucessfully:
http://sislands.com/coin70/week3/dayofwk.htm
ciao, Dave