我有一个日期字符串格式,比如“2010-03-01”,我想得到等效于它的“tm_wday”,比如星期一、星期二......
谁能给我一个关于如何在 c 中实现这一点的提示?
最佳答案
检查 strptime()
功能:
char *strptime(const char *s, const char *format, struct tm *tm);
The strptime() function is the converse function to strftime(3) and converts the character string pointed to by s to values which are stored in the tm structure pointed to by tm, using the format specified by format.
关于c - 如何将日期字符串转换为 tm 结构中的 tm_wday,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3386633/