Qt 计算两个日期的时间差并以时分秒显示出来


QDateTime begin_time = QDateTime::currentDateTime(); //获取或设置时间
QDateTime end_time = QDateTime::currentDateTime(); //获取或设置时间
QTime m_time;
m_time.setHMS(0, 0, 0, 0); //初始化数据,时 分 秒 毫秒
m_time.addSecs(begin_time.secsTo(end_time)).toString("hh:mm:ss");//计算时间差(秒),将时间差加入m_time,格式化输出
 
原文链接:https://blog.csdn.net/u014783974/article/details/79085478


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM