Possible Duplicate:
C Program to find day of week given date
I have a calendar file that gives dates as "20121027T190000" and I need to convert that to "Wednesday, October 27 2012, 1900". Is there a C function that computes the day of the week?
Possible Duplicate:
C Program to find day of week given date
I have a calendar file that gives dates as "20121027T190000" and I need to convert that to "Wednesday, October 27 2012, 1900". Is there a C function that computes the day of the week?
Yes, the standard localtime()
function converts from a time_t
to a struct tm
that includes the day of the week. To create a time_t
value, you can use the mktime()
function to convert from a struct tm
to a time_t
(you do not have to fill in the day of the week when using mktime()
).
This might seem like a roundabout way to do this, but it's reasonably straightforward and uses standard library functions.