• 6136阅读
  • 3回复

知道秒数,求好的时间转化方法。。 [复制链接]

上一主题 下一主题
离线robertkun
 

只看楼主 倒序阅读 楼主  发表于: 2009-09-22
最近遇到一个时间转换的问题,知道秒数怎样高效地转换为时间呢?谢谢~
                                              简单的生活使人快乐!
离线robertkun

只看该作者 1楼 发表于: 2009-09-22
结帖了,现在用这个方法,觉得挺不错的

    QString strTime = "00:00:00:00";

    QTime it;
    it = it.addSecs(msecxs); //这里设置秒数
    strTime = it.toString("hh:mm:ss:zz");
                                              简单的生活使人快乐!
离线jorneyr

只看该作者 2楼 发表于: 2009-09-22


void QDateTime::setTime_t ( uint seconds )

Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC.

See also toTime_t().
离线robertkun

只看该作者 3楼 发表于: 2009-09-22
引用第2楼jorneyr于2009-09-22 14:28发表的  :

void QDateTime::setTime_t ( uint seconds )
Sets the date and time given the number of seconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC.
.......



setTime_t  这个东东还有用过,不知道好在哪里?2楼的兄弟能说明一下吗?
                                              简单的生活使人快乐!
快速回复
限100 字节
 
上一个 下一个