Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Change language of date

    QML and Qt Quick
    qml date language
    1
    1
    671
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      helenebro last edited by helenebro

      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"));
      QLocale::setDefault(curLocale);
      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 ?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post