我正在尝试使用 转换特定格式的日期,但strptime
我意识到有关 AM/PM 的信息丢失了。不知道为什么。
这是代码。
struct tm t;
strptime("Wed 4/18/2007 4:28:22 PM", "%a %m/%d/%Y %H:%M:%S %p", &t);
std::cout<<t.tm_hour<<endl;
strptime("Wed 4/18/2007 4:28:22 AM", "%a %m/%d/%Y %H:%M:%S %p", &t);
std::cout<<t.tm_hour<<endl;
谁能告诉我有说明%p
符的目的是什么strptime
?
在此先感谢, AJ