I am trying to create a tm structure from a user specified date. How do I calculate tm_wday and tm_yday? Below is an example.
Code:
int main(void)
{
CreateTmStruct( 2009, 9, 30, 10, 7, 30 );
}
CreateTmStruct( int Year, int Month, int Day, int Hour, int Minutes, int Seconds )
{
struct tm tmStruct;
tmStruct.tm_sec = Seconds;
tmStruct.tm_min = Minutes;
tmStruct.tm_hour = Hour;
tmStruct.tm_mon = Month + 1;
tmStruct.tm_year = Year - 1900;
tmStruct.tm_wday = ?;
tmStruct.tm_yday = ?;
tmStruct.tm_isdst = 0;
}