so far im using:
QTime time = QTime::currentTime();
QString formattedTime = time.toString("hh:mm:ss");
QByteArray formattedTimeMsg = formattedTime.toLocal8Bit();
how do i change this to have date and time as "DD.MM.YYYY hh:mm:ss"?
QDateTime date = QDateTime::currentDateTime();
QString formattedTime = date.toString("dd.MM.yyyy hh:mm:ss");
QByteArray formattedTimeMsg = formattedTime.toLocal8Bit();
qDebug() << "Date:"+formattedTime;
You can find more details here https://doc.qt.io/qt-5/qdatetime.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With