02-10-2013 06:54 PM
Hi all!
I know how to get the current Date/ Time like this:
Label {
text: {
new Date();
}
}
in which the label displays, for example : "2013-02-10T15:52:28"
how do I ONLY display the hour(15)?
Thanks,
-Ali
Solved! Go to Solution.
02-10-2013 07:01 PM
Hi,
Use Qt formatDateTime method:
http://qt-project.org/doc/qt-4.8/qml-qt.html#forma
For hours:
var hours = Qt.formatDateTime(new Date(), "hh"); // or "h"
02-10-2013 07:15 PM
02-10-2013 07:34 PM
Thank you both for your suggestions! ![]()
I ended up using this code:
Label{
text: {
var hours = Qt.formatDateTime(new Date(), "hh");
return hours;
}
}