Date format (solved)



  • The code below work, it give "Mon, April 13 2015 "
    but i want "13 April 15"
    Please advice.

    DateLabel1 = new QLabel;
    //QDateTime dateTime = QDateTime::currentDateTime();
    QDate dateTime1 = QDate::currentDate();
    QString datetimetext = dateTime1.toString();
    DateLabel1->setText(datetimetext);
    DateLabel1->setFont(f);
    DateLabel1->setAlignment(Qt::AlignCenter);
    DateLabel1->setStyleSheet("QLabel { color : white; }");


  • Hi,
    use: QString datetimetext = dateTime1.toString("d MMMM yy");


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.