帮忙把这串数字转换为具体的时间1373880834 1373880848 1373880855 1373880877 1373880893 1373880925 1373880946 1373881039 1373881040 1373881044 1373881090 1373881172 1373881192 1373881196 1373881199 1373881205 1373881209 1373881213 能不
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 14:31:35
帮忙把这串数字转换为具体的时间1373880834 1373880848 1373880855 1373880877 1373880893 1373880925 1373880946 1373881039 1373881040 1373881044 1373881090 1373881172 1373881192 1373881196 1373881199 1373881205 1373881209 1373881213 能不
帮忙把这串数字转换为具体的时间
1373880834 1373880848 1373880855 1373880877 1373880893 1373880925 1373880946 1373881039 1373881040 1373881044 1373881090 1373881172 1373881192 1373881196 1373881199 1373881205 1373881209 1373881213
能不能帮我把这串数字转换为具体的日期时间,精确到秒,最好解释下为什么,
帮忙把这串数字转换为具体的时间1373880834 1373880848 1373880855 1373880877 1373880893 1373880925 1373880946 1373881039 1373881040 1373881044 1373881090 1373881172 1373881192 1373881196 1373881199 1373881205 1373881209 1373881213 能不
#include <stdio.h>
#include <time.h>
#include <stdio.h>
#include <time.h>
int main(void)
{
int i;
struct tm *tm;
time_t t;
char msg[50];
long times[18]={1373880834,1373880848,1373880855,1373880877,1373880893,1373880925,1373880946,1373881039,1373881040,1373881044,
1373881090,1373881172,1373881192,1373881196,1373881199,1373881205,1373881209,1373881213};
for(i=0;i<18;i++)
{
t = times[i];// 记录从1970以来过去的时间,秒
tm=localtime(&t);
sprintf(msg,"%04d-%02d-%02d %02d:%02d:%02d",tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
printf("%s\n",msg);
}
return 0;
}