Friday, 15 March 2013

qt - Display month and day in localized format -


I have to get the right month and day format for different places. I have QLable and QDate , labels should display months and days. I'll try the format date by QLocale .

  // Yes, I got the system locale and the set is in the form of the default QLocale :: To string (date, "MMMM D");  

But the result is wrong.

"DMMMM for French

For example, the equivalent of the German locale is" MMMM d ":

P>

"DMMM"

How to define the format of "MMMM d" locale settings in QT 4.8?

Thanks!

In PS JavaScript, I use the following code

  var date = new date (date.UTC (2012, 11, 20, 3, 0, 0)); Options = {Month: 'tall', day: 'numeric'}; Console.log (date.toLocaleDateString ('de-DE', option));    

One way to do this is by QLocale :: LongFormat :

  #include & lt; QtGui & gt; int main (int Argc, char * argv []) {Q Application app (argc, argv); QList & lt; QLocale> Locations  

Output:

  "en-US" "MMMM D" "March 17" "D-Day" "DMMM" "17." MRM "" FER-FR "" DMMM "" March 17 "" RU-RU "" DMMM "" 17 MART "" CH-CN "MmD" 3 月 17 "" Co-KR "" M 월 D 일 " "3 월 17 일"  

No comments:

Post a Comment