当前位置:网站首页>常用日期格式符与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秒");
边栏推荐
- 2021-03-16 COMP9021第九节课笔记
- 软件过程与项目管理期末复习与重点
- 到底哪一首才是唐诗第一?
- C语言_字符串与指针的爱恨情仇
- 2021-03-04 comp9021 class 6 notes
- Live broadcast review | detailed explanation of koordinator architecture of cloud native hybrid system (complete ppt attached)
- Swift Extension NetworkUtil(網絡監聽)(源碼)
- 普通token
- etcd备份恢复原理详解及踩坑实录
- How to design a highly available and extended image storage function
猜你喜欢

Question 3 - MessageBox pop-up box, modify the default background color

Markdown 实现文内链接跳转

More appropriate development mode under epidemic situation

Shader common functions

小样本故障诊断 - 注意力机制代码 - BiGRU代码解析实现

2022年制冷与空调设备运行操作上岗证题库及模拟考试

List of Li Bai's 20 most classic poems

一文带你了解Windows操作系统安全,保护自己的电脑不受侵害

Swift foundation features unique to swift

Qt导出PDF文件的两种方法
随机推荐
All you know is the test pyramid?
PAT 1157:校庆
新准则金融资产三分类:AMC、FVOCI和FVTPL
Final review and key points of software process and project management
Pat 1157: school anniversary
软件过程与项目管理期末复习与重点
2022 tea artist (intermediate) work license question bank and online simulation examination
Industrial computer anti cracking
Shader common functions
直播回顾 | 云原生混部系统 Koordinator 架构详解(附完整PPT)
有关iframe锚点,锚点出现上下偏移,锚点出现页面显示问题.iframe的srcdoc问题
2021-03-16 COMP9021第九节课笔记
Pagoda panel installation php7.2 installation phalcon3.3.2
2021-03-11 COMP9021第八节课笔记
根据网络上的视频的m3u8文件通过ffmpeg进行合成视频
Coordinate transformation of graphic technology
权限模型 DAC ACL RBAC ABAC
Introduction to software engineering - Chapter 2 - feasibility study
For a detailed explanation of flex:1, flex:1
Dart development server, do I have a fever?