PDA

View Full Version : QLocale, dateFormat, short and long, Get all format strings?



HappyCoder
9th March 2017, 08:08
Hi,

e.g. when i use QLocale and dateFormat i can get either the long or short format.
But in Windows (settings for language) are more than one short format for date:

dateFormat(QLocale::ShortFormat) returns only the current system setting.
e.g. M/T/JJJJ

but there are more like this:
M/T/JJ
MM/TT/JJ
and 4 other formats

How can i get all possible short format strings from system?

Greetings

Santosh Reddy
9th March 2017, 12:21
There is no Qt API, you will write down all the valid combinations yourself.

HappyCoder
9th March 2017, 13:10
Thx, some minutes ago i found this:
https://msdn.microsoft.com/de-de/library/aszyst2c(v=vs.110).aspx
DateTimeFormatInfo::GetAllDateTimePatterns-Methode:() from .NET

and here with example:
https://msdn.microsoft.com/de-de/library/dah0ktz1(v=vs.110).aspx

I will try to use that, hope it helps.