我试图用strptime
来转换特定格式的日期,并且我意识到关于AM/PM的信息丢失了。不知道为什么。strptime问题() - %p没有考虑到
这是代码。
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;
任何人能告诉我什么是具有strptime
的%p
符的目的是什么?
由于提前, AJ