Qt获取当前时间的两种方式笔记

来源:互联网 发布:断鸿零雁记 知乎 编辑:程序博客网 时间:2024/06/10 09:19

原文地址::http://blog.csdn.net/philosophyatmath/article/details/41803111


相关文章

1、Qt 获取当前时间----http://blog.csdn.net/lusirking/article/details/51460716


  1. QDateTime dt;  
  2. QTime time;  
  3. QDate date;  
  4. dt.setTime(time.currentTime());  
  5. dt.setDate(date.currentDate());  
  6. QString currentDate = dt.toString("yyyy:MM:dd:hh:mm:ss");  
  7. qDebug()<<currentDate<<"-=-=-=-=-=-=-=-";  
  8.   
  9. QDateTime current_date_time = QDateTime::currentDateTime();  
  10. QString current_date = current_date_time.toString("yyyy-MM-dd hh:mm:ss ddd");  
  11.   
  12. qDebug()<<current_date<<"-=-=-=-=-=-=-=-";  




原创粉丝点击