23,125
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <time.h>
int main ()
{
char timestr[128];
time_t now = /* time (0) */1439460264;
struct tm tm_now;
localtime_r (&now, &tm_now);
strftime (timestr, sizeof (timestr), "%Y-%m-%d %H:%M:%S", &tm_now);
printf ("%s\n", timestr);
return 0;
}
打印出来的是 2015-08-13 18:04:24