首先我们查看man手册关于strptime和strftime的描述
strptime()函数:

函数原型: char *strptime(const char *s, const char *format, struct tm *tm);
*s:字符串指针,用来接收tm结构体中的时间
*format:格式化字符串
tm:时间结构体
程序:

运行结果: 
strftime()函数与strptime函数正好相反,将指针指向中的时间字符串转化为tm结构体类型的时间
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/231453.html原文链接:https://javaforall.net
