1、格式化输出当前时刻
qDebug()<<"currentTime--"<<QTime::currentTime().toString(Qt::ISODate)
<<QDateTime::currentDateTime().toString(Qt::ISODate)
<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss:zzz");
输出为
currentTime--
"16:03:27"
"2016-02-24T16:03:27"
"2016-02-24 16:03:27:607"
//获取当前时间QDateTime current_date_time = QDateTime::currentDateTime();QString current_date = current_date_time.toString("yyyy-MM-dd");QString current_time = current_date_time.toString("hh:mm:ss.zzz ");