Qt6 topics merged with General

Change language of date

  • Hi,
    I want display an date on a app but the language isn't correct.

    var dateProgramme = Date.fromLocaleString(Qt.locale("en_US"), previewInfo.dataCurrentItem.dateDiffusion, "dd/MM/yyyy")
    console.log(dateProgramme); // Display date in french : "lun. févr. 15 00:00:00 2016 GMT+0100"

    I have tried to change qlocale language on main.cpp but it change nothing. (It seems language is only change on cpp).

    QLocale curLocale(QLocale("en_US"));
    QDate date = QDate::currentDate();
    QString dateString = QLocale().toString(date);
    qDebug() << dateString; //Display date in english:  "Monday, February 15, 2016" 

    How can I change language on qml ?

Log in to reply