Qt获取编译时间

#include 

#include 
#include 
#include 

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    static const QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace("  ", " 0"), "MMM dd yyyy");
    static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");

    qDebug() << buildDate.toString("yyyy.MM.dd");
    qDebug() << buildTime.toString();

    qDebug() << QString("%1 %2").arg(buildDate.toString("yyyy.MM.dd")).arg(buildTime.toString());

    return a.exec();
}

 

你可能感兴趣的:(Qt)