views:

51

answers:

1

Hi,

What is the most appropriate method to change the system date (on Windows) programmatically using Qt4. I'm using Qt Creator 1.3.1.

+5  A: 

Use Windows API, GetLocalTime and SetLocalTime.

SYSTEMTIME localTime;
GetLocalTime(&localTime);

localTime.wHour = 21;
localTime.wMinute = 30;

if (SetLocalTime(&localTime) != 0)
{
    // ok
}
else
{
    // failed
}
Roku
I guess using API is the only option for me right now. Thanks.
Nadee