QT时间日期
来源:互联网 发布:舰队collection 知乎 编辑:程序博客网 时间:2024/04/30 12:11
获取系统当前时间并设置显示格式
QDateTime current_date_time =QDateTime::currentDateTime();QString current_date =current_date_time.toString("yyyy-MM-dd hh:mm:ss ddd");
例:2016-06-25 18::10 周五
获取当前时间时、分、秒
范围:小时(0--23)、分钟(0--59)、秒(0--59)、毫秒(0--999)
QTime current_time = QTime::currentTime();int hour = current_time.hour();int minute = current_time.minute();int second = current_time.second();int msec = current_time.msec();
比较日期大小
//获取当前时间及文件缓存时间
QDateTime currentDateTime = QDateTime::currentDateTime();QDateTime dateTime = QDateTime::fromString(strDate, sDateTimeFormat);
//获取文件缓存一个月之后的时间
QDateTime afterOneMonthDateTime = dateTime.addMonths(1);
//如果缓存时间超过一个月,则删除
qint64 nSecs =afterOneMonthDateTime.secsTo(currentDateTime);if (nSecs > 0){ QFile::remove(strFilePath);}
0 0
- qt日期时间
- QT时间日期
- Qt之日期时间
- Qt时间日期
- Qt之日期时间
- QT:日期时间编辑器MyDateTimeEdit
- Qt中的日期时间类
- Qt QTableView显示日期时间格式
- Qt QTableView显示日期时间格式
- Qt获取当前日期与时间
- qt获取当前时间以及日期
- QT系列:获取系统时间 日期时间格式
- QT获取系统时间,以及设置日期格式
- QT获取系统时间以及设置日期格式
- QT获取系统时间,以及设置日期格式
- QT获取系统时间,以及设置日期格式
- QT编程中mysql数据库的时间、日期的运用
- QT时间相关的使用(日期相减问题)
- 《GMTC全球移动技术大会》参会总结
- 我的第一次打字测试
- OkHttp的相关
- 相機预览类
- 台大林轩田·机器学习技法记要
- QT时间日期
- UEditor 富文本向.net后台传值问题解决方案
- 牛客网校招风暴周算法题-回文数列
- AlertDialog的自定义
- 静态数据竞争检测工具之RELAY-安装和使用
- python 标识符
- 剑指offer——链表中环的入口节点
- 【译】唯快不破:Web 应用的 13 个优化步骤
- java 类反射机制