Qt中获取当前的系统时间的类有QDate和QTime,其中QDate类对应日期,QTime类对应时间。比如:
//获取系统现在的时间并设置显示格式
QDateTime current_date_time = QDateTime::currentDateTime();
QString current_date = current_date_time.toString("yyyy-MM-dd hh:mm:ss ddd");
例:2013-05-24 13:09:10 周五
//获取当前时间,范围:小时(0--23)、分钟(0--59)、秒(0--59)、毫秒(0--999)
QTime current_time = QTime::currentTime();
int hour = current_time.hour();
int minute = current_time.minute();
int second = current_time.second();
int msec = current_time.msec();