How to populate SYSTEMTIME value?

systemtime, windows-mobile

Solution

You could fill in the fields you know, then convert to variant time and back.

That might fill in the missing data.

Problem

On Windows Mobile (but I guess it's the same on Windows) in a native C++ app, how would I go about setting a SYSTEMTIME structure correctly? Assuming I have ``` int year, month, dayOfMonth, hour, minute, second; ``` I obviously should set the wHour, wYear, etc members of the SYSTEMTIME structure, but what happens with wDayOfWeek in that case, I would rather have this set up correctly as well. I have looked but not found any functions in MSDN that would allow me to populate a SYSTEMTIME structure where the wDayOfWeek member would be calculated for me. Did I miss something or how would I go about that?

Original source