qt获取当前时间以及日期
来源:互联网 发布:linux创建目录命令 编辑:程序博客网 时间:2024/05/21 16:57
要在一个label上设置当前时间 QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间QString str = time.toString("yyyy-MM-dd hh:mm:ss ddd"); //设置显示格式label->setText(str);//在标签上显示时间QString QDateTime::toString ( const QString & format ) constReturns the datetime as a string. The format parameter determines the format of the result string.These expressions may be used for the date:Expression Outputd the day as number without a leading zero (1 to 31)dd the day as number with a leading zero (01 to 31)ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses QDate::shortDayName().dddd the long localized day name (e.g. 'Monday' to 'Qt::Sunday'). Uses QDate::longDayName().M the month as number without a leading zero (1-12)MM the month as number with a leading zero (01-12)MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses QDate::shortMonthName().MMMM the long localized month name (e.g. 'January' to 'December'). Uses QDate::longMonthName().yy the year as two digit number (00-99)yyyy the year as four digit numberThese expressions may be used for the time:Expression Outputh the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)hh the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)m the minute without a leading zero (0 to 59)mm the minute with a leading zero (00 to 59)s the second without a leading zero (0 to 59)ss the second with a leading zero (00 to 59)z the milliseconds without leading zeroes (0 to 999)zzz the milliseconds with leading zeroes (000 to 999)AP use AM/PM display. AP will be replaced by either "AM" or "PM".ap use am/pm display. ap will be replaced by either "am" or "pm".All other input characters will be ignored. Any sequence of characters that are enclosed in singlequotes will be treated as text and not be used as an expression. Two consecutive singlequotes ("''") are replaced by a singlequote in the output.Example format strings (assumed that the QDateTime is 21 May 2001 14:13:09):Format Resultdd.MM.yyyy 21.05.2001ddd MMMM d yy Tue May 21 01hh:mm:ss.zzz 14:13:09.042h:m:s ap 2:13:9 pm
0 0
- qt获取当前时间以及日期
- Qt获取当前日期与时间
- js获取当前时间以及日期格式化
- 获取当前日期时间
- 获取当前日期时间
- Qt获取当前时间
- Qt获取当前时间
- QT 获取当前时间
- Qt获取当前时间
- Qt 获取当前时间
- c#获取当前日期时间以及格式化操作
- QT获取系统时间,以及设置日期格式
- QT获取系统时间以及设置日期格式
- QT获取系统时间,以及设置日期格式
- QT获取系统时间,以及设置日期格式
- j2ee 获取当前日期时间
- Android 获取当前日期 时间
- C#获取当前日期时间
- 归并排序
- android studio的一些编译错误
- Selenium+PhantomJS 爬取页面
- POJ 2965 The Pilots Brothers' refrigerator 枚举dfs
- lintcode-逆波兰表达式求值-424
- qt获取当前时间以及日期
- POJ 1014 && HDU 1059 Dividing(完全背包问题)
- Android中创建AIDL服务的步骤
- Java 的布局管理器GridBagLayout的使用方法【图文说明】
- [234]Palindrome Linked List
- c++ primer学习笔记3_复合类型
- 如何使用Android Studio把自己的Android library分享到jCenter和Maven Central
- ***6.22-八皇后问题
- 大数据系列二(1)---时代的印记(互联网,云计算)