1, time_t 转 struct tm
struct tm *localtime( const time_t *timer );
2,struct tm 转 time_t
time_t mktime( struct tm *timeptr );
3,CTime 转 time_t
用CTime类中的GetTime成员函数即可
本文介绍了三种常用的时间转换方法:从time_t类型转换到struct tm类型的localtime函数;从struct tm类型转换到time_t类型的mktime函数;以及使用CTime类的GetTime成员函数实现CTime到time_t的转换。
1, time_t 转 struct tm
struct tm *localtime( const time_t *timer );
2,struct tm 转 time_t
time_t mktime( struct tm *timeptr );
3,CTime 转 time_t
用CTime类中的GetTime成员函数即可
9833

被折叠的 条评论
为什么被折叠?