gpt4 book ai didi

c - 如何将日期字符串转换为 tm 结构中的 tm_wday

转载 作者:太空狗 更新时间:2023-10-29 15:33:54 30 4
gpt4 key购买 nike

我有一个日期字符串格式,比如“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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com