I am trying to get a CDateTimeCtrl control in a dlg box to show 24 hour time format rather than am/pm nonsense.
I would have thought there was a flag for this, but MS decided NOT to provide one.
Is it possible?
Even though CDateTimeCtrl
doesn't provide a class method to change the format, the class itself wraps the Win32 date and time picker which does allow you to set a custom format. You can do this by sending a message directly to the control:
DateTime_SetFormat(m_dateTime.m_hWnd, TEXT("HH:mm:ss"));
Edit: As @Kirill V. Lyadvinsky points out, you can simply use the CDateTimeCtrl::SetFormat
method -- I somehow missed that when I was looking at the reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.