当前位置:网站首页>常用日期格式符与Qt获取当前时间的办法
常用日期格式符与Qt获取当前时间的办法
2022-06-24 06:58:00 【百口可乐__】
常用日期格式符及其意义:
| 字符 | 意义 |
|---|---|
| yy | 年,两位显示,00-99 |
| yyyy | 年,四位显示,如2016 |
| M | 月,不补零显示,1-12 |
| MM | 月,补零显示,01-12 |
| d | 天,不补零显示,1-31 |
| dd | 天,补零显示,01-31 |
| h | 小时,不补零,0-23或1-12(如果显示AM/PM) |
| hh | 小时,补零2位显示,00-23或01-12(如果显示AM/PM) |
| H | 小时,不补零,0-23或1-12(即使显示AM/PM) |
| HH | 小时,补零2位显示,00-23或01-12(即使显示AM/PM) |
| m | 分钟,不补零,0-59 |
| mm | 分钟,补零显示,00-59 |
| z | 毫秒,不补零,0-999 |
| zzz | 毫秒,补零3位显示,000-999 |
| AP或A | 使用 AM/PM 显示 |
| ap或a | 使用 am/pm 显示 |
文本转化日期:
QDateTime dateTime = QDateTime::fromString("2022/06/23 23:05:24","yyyy/MM/dd hh:mm:ss");
日期转化文本:
QString timeStr = QDateTime::currentDateTime().toString("yyyy年MM月dd日 hh时mm分ss秒");
QString timeStr1 = dateTime.toString("yyyy年MM月dd日 hh时mm分ss秒");
边栏推荐
- 13 -- 移除无效的括号
- PAT 1157:校庆
- Opening chapter of online document technology - rich text editor
- io模型初探
- The applet reads more than 20 data, and the cloud function reads more than 100 restrictions
- etcd备份恢复原理详解及踩坑实录
- LabVIEW finds prime numbers in an array of n elements
- LINQ query (2)
- 2021-03-09 comp9021 class 7 Notes
- 自动化测试的未来趋势
猜你喜欢

Pat 1157: school anniversary

Pipeline concept of graphic technology

FPGA的虚拟时钟如何使用?

2021-03-16 COMP9021第九节课笔记

The article takes you to understand the security of Windows operating system and protect your computer from infringement

Longhorn installation and use

OC extension detects whether an app is installed on the mobile phone (source code)

问题3 — messageBox弹框,修改默认背景色

MAYA重新拓布

5分钟,客服聊天处理技巧,炉火纯青
随机推荐
Four models of iPhone 13 series have been exposed, and indeed, they are 13 fragrant!
Saccadenet: use corner features to fine tune the two stage prediction frame | CVPR 2020
Swift 基础 闭包/Block的使用(源码)
Swift extension networkutil (network monitoring) (source code)
5分钟,客服聊天处理技巧,炉火纯青
问题3 — messageBox弹框,修改默认背景色
Getting started with ffmpeg
Question 4 - datepicker date selector, disabling two date selectors (start and end dates)
For a detailed explanation of flex:1, flex:1
权限模型 DAC ACL RBAC ABAC
13 -- 移除无效的括号
【毕业季】你好陌生人,这是一封粉色信笺
Unity culling related technologies
Interview tutorial - multi thread knowledge sorting
你还只知道测试金字塔?
51 single chip microcomputer_ External interrupt and timer / Counter interrupt
51单片机_外部中断 与 定时/计数器中断
Synthesize video through ffmpeg according to m3u8 file of video on the network
2021-03-04 COMP9021第六节课笔记
Question 1: the container that holds the most water