Qt->数字格式化

QDateTime time = QDateTime::currentDateTime();
QString strTime = QString("%1%2%3")
            .arg(time.date().year(), 4, 10, QChar('0'))
            .arg(time.date().month(), 2, 10, QChar('0'))
            .arg(time.date().day(), 2, 10, QChar('0'));

那么strTime的输出为:20140905

posted on 2014-09-05 14:29  trako  阅读(632)  评论(0编辑  收藏  举报

导航