How to get localized date and time from SYSTEMTIME

I have SYSTEMTIME, and I'm trying to get a localized string with date and time values. An API, such as GetDateFormat / GetTimeFormat, gets either a date or time, but not both.

Is there an API available that will give me a localized string specifying the date and time from SYSTEMTIME?

+4
source share
1 answer

There is no date / time format string in the Windows API. It has separate date and time format strings.

.Net has DateTimeFormatInfo.FullDateTimePattern , but looking in Reflector it seems to be initialized:

 LongDatePattern + " " + LongTimePattern 

and the value that it has for all 354 cultures on my Windows 7 PC. You would only see what did not match this pattern if the program created a custom .Net culture and defined it differently.

I worked on software that was sold all over the world, and no one ever complained that we were using a date and time separated by a space.

+2
source

Source: https://habr.com/ru/post/1435977/


All Articles