I'm using the following code to set the format of the Time Picker control (with the Win32 class name SysDateTimePick32
) to display time in US English format only:
LCID lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
TCHAR buffFmt[200] = {0};
GetLocaleInfo(lcid, LOCALE_STIMEFORMAT, buffFmt, SIZEOF(buffFmt));
TRACE(buffFmt); //"h:mm:ss tt"
::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)buffFmt);
When I run it on my Windows 7 set up for US English user account the control looks good like this:
But if I run it on a Windows 7 with the user account set up for a German format:
the control looks as such (AM/PM part is missing):
Note that in both cases the format string is "h:mm:ss tt", which according to this page means that tt
should stand for AM/PM part.
Any idea how to fix this?