字符串时间:
= time(0);
char now[64];
strftime(
now, // 接收时间的字符串
sizeof(now)-1, // 被复制到字符串的最大字节数
"%Y-%m-%d %H:%M:%S", // 输出时间的格式(年月日时分秒)
localtime(&t) // 指向 tm 结构的指针
);
时间戳:
;
time(&t);
cout << "时间戳 = " << t << endl;
微信扫一扫
字符串时间:
= time(0);
char now[64];
strftime(
now, // 接收时间的字符串
sizeof(now)-1, // 被复制到字符串的最大字节数
"%Y-%m-%d %H:%M:%S", // 输出时间的格式(年月日时分秒)
localtime(&t) // 指向 tm 结构的指针
);
时间戳:
;
time(&t);
cout << "时间戳 = " << t << endl;
相关推荐