[Interest] [QML] Qt.formatDateTime() and AM/PM

Kristoffersen, Even (NO14) Even.Kristoffersen at Honeywell.com
Thu Jul 14 15:21:27 CEST 2016


Elvis: Tack
Rainer: Danke

Maybe the format function uses the system locale instead of default QLocale, that would explain it.


-Even


From: Interest [mailto:interest-bounces+even.kristoffersen=honeywell.com at qt-project.org] On Behalf Of Rainer Wiesenfarth
Sent: 14. juli 2016 15:12
To: interestqt-project.org <interest at qt-project.org>
Subject: Re: [Interest] [QML] Qt.formatDateTime() and AM/PM


2016-07-14 14:31 GMT+02:00 Elvis Stansvik <elvstone at gmail.com<mailto:elvstone at gmail.com>>:
estan at newton:~$ cat test.qml
import QtQuick 2.0

Item {
    Component.onCompleted: console.info<http://console.info>(Qt.formatDateTime(new Date(),
"hh:mm:ss AP"));
}
estan at newton:~$

​I am able to reproduce the problem with 5.6.0 on Windows, using your snippet:​

​D:\Develop\tests>qmlscene test.qml
qml: Do 03:04:31
​
​No am/pm is added, but hour is 0-12. But...

... this is with "Region and Language" set to German. If I set it to English, the output is as expected:

D:\Develop\tests>qmlscene test.qml
qml: Thu 03:05:37 PM

​So the problem seems to be the missing translation for "PM" and "AM"​, but this may be related to Windows rather than Qt.

--
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/imaging/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Jürgen Kesper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160714/983774ae/attachment.html>


More information about the Interest mailing list