Getting correctly formatted date and time

Date and time should be formatted according to current locale/UI language.

This can be done using Qt.formatDate and Qt.formatTime.

string Qt::formatDate ( datetime date, variant format ) 
string Qt::formatTime ( datetime time, variant format )


property string date1: Qt.formatDate(new Date)  // current date&time
    property string date2: Qt.formatDate(new Date, Qt.DefaultLocaleLongDate)
    property string time: Qt.formatTime(new Date)

    Text {
        text: qsTr("short date: %1").arg(date1)
    Text {
        text: qsTr("long date: %1").arg(date2)
    Text {
        text: qsTr("time: %1").arg(time)

If format, like in this case, is not specified, it's fetched from locale. On the Symbian platform, these are mapped to ShortDateFormatSpec, LongDateFormatSpec (in case of Qt.DefaultLocaleLongDate) and TimeFormatSpec.

Current values defined in locale are not best possible ones, so those need to be modified to get correct results.

Check also how locale data changes from control panel should be reacted upon. For more information, see QML Qt Element.