#include<QDataTime>
具体实现:
QDateTime dTime; QTime time; QDate date; dTime.setTime(time.currentTime()); dTime.setDate(date.currentDate()); QString currentDate = dTime.toString("yyyy:MM:dd:hh:mm:ss");