Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DefCom

Day from Date, Win32

This topic is 5424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Does anyone know if there is a method to find the day from a given date i.e. 13/01/03 is a Tuesday. Thanks.

Share this post


Link to post
Share on other sites
Advertisement

std::string GetDayOfWeek(WORD Year, WORD Month, WORD Day)
{
SYSTEMTIME ST;
FILETIME FT;

ZeroMemory(&ST, sizeof(ST));
ST.wYear = Year;
ST.wMonth = Month;
ST.wDay = Day;

SystemTimeToFileTime(&ST, &FT);
FileTimeToSystemTime(&FT, &ST);

switch(ST.wDayOfWeek)
{
case 0: return "Sunday";
case 1: return "Monday";
case 2: return "Tuesday";
case 3: return "Wednesday";
case 4: return "Thursday";
case 5: return "Friday";
case 6: return "Saturday";
default: return "Unknown";
}
}

Share this post


Link to post
Share on other sites
Hmm... I must''ve accidentally clicked the option button. I''m not a regular poster on message boards (at least up until recently), so I barely even notice half the options that are available to me, such as these here icons. Silly me. Maybe I''ll be a wee bit more aware of them now.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!