Qt 时间获取
1. QDateTime
函数介绍:
QString QDateTime::toString ( const QString & format ) const
Returns the datetime as a string. The format parameter determines the format of the result string.
-
日期示例:
-
时间示例
-
综合范例
示例代码
QDateTime time = QDateTime::currentDateTime();
QString str = time.toString("yyyy-MM-dd hh:mm:ss ddd");