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

Rainer Wiesenfarth rainer_wiesenfarth at trimble.com
Thu Jul 14 15:11:47 CEST 2016


2016-07-14 14:31 GMT+02:00 Elvis Stansvik <elvstone at gmail.com>:

> estan at newton:~$ cat test.qml
> import QtQuick 2.0
>
> Item {
>     Component.onCompleted: 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/e761b0bb/attachment.html>


More information about the Interest mailing list