time_t t = time(0);
//产生"YYYY-MM-DD hh:mm:ss"格式的字符串。
char s[32] = {0};
strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S", localtime(&t));
格式化时间
最新推荐文章于 2025-01-20 19:31:19 发布
time_t t = time(0);
//产生"YYYY-MM-DD hh:mm:ss"格式的字符串。
char s[32] = {0};
strftime(s, sizeof(s), "%Y-%m-%d %H:%M:%S", localtime(&t));