#include <QDateTime>
QDateTime current_date_time = QDateTime::currentDateTime();
QString cdt = current_date_time.toString("yyyy-MM-dd hh:mm:ss ddd");
QTime current_time = QTime::currentTime();
QString ct = current_time.toString();
QDate current_date = QDate::currentDate();
QString cd = current_date.toString();
int hour = current_time.hour();
int minute = current_time.minute();
int second = current_time.second();
int msec = current_time.msec();
qDebug()<<current_date_time<<current_date<<current_time;
qDebug()<<cdt<<cd<<ct;
qDebug()<<hour<<minute<<second<<msec;
//输出如下:
//QDateTime("周日 三月 30 15:34:58 2014") QDate("周日 三月 30 2014") QTime("15:34:58")
//"2014-03-30 15:34:58 周日" "周日 三月 30 2014" "15:34:58"
//15 34 58 593