TIME_ZONE_INFORMATION tzi;
if ( GetTimeZoneInformation( &tzi ) == TIME_ZONE_ID_INVALID )
MyErrorFunction( "GetTimeZoneInformation() = TIME_ZONE_ID_INVALID : %s",
GetLastErrorAsString().c_str() );
:
:
SYSTEMTIME st, stLocal;
BOOL bRV = FileTimeToSystemTime( ftLastAccessTime, &st );
SystemTimeToTzSpecificLocalTime( &tzi, &st, &stLocal );
GetDateFormat( LOCALE_USER_DEFAULT, DATE_LONGDATE, &stLocal,
NULL, szBuf, sizeof( szBuf ) );
int iBufUsed = strlen( szBuf );
if ( iBufUsed < sizeof( szBuf ) - 2 )
szBuf[ iBufUsed++ ] = ' ';
GetTimeFormat( LOCALE_USER_DEFAULT, 0, &stLocal,
NULL, szBuf + iBufUsed, sizeof( szBuf ) - iBufUsed );
// szBuf holds Date and Time, in the user's timezone, formatted as the user prefers.