1 #include <QDebug>
2 #include <QDate>
3 #include <QTime>
4
5 const void getBuildTime()
6 {
7 static const QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
8 static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
9
10 qDebug() << buildDate.toString("yyyy.MM.dd");
11 qDebug() << buildTime.toString();
12
13 qDebug() << QString("%1 %2").arg(buildDate.toString("yyyy.MM.dd")).arg(buildTime.toString());
14 }
15
16 const QDateTime buildDateTime()
17 {
18 QString dateTime;
19 dateTime += __DATE__;
20 dateTime += __TIME__;
21 return QLocale(QLocale::English).toDateTime(dateTime, "MMM dd yyyyhh:mm:ss");
22 }