I am trying to convert a date in a particular format using strptime
, and i realized that the information about AM/PM is lost. Not sure why.
Here is the code.
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;
Can anybody tell me whats the purpose of having the %p
specifier in strptime
?
Thanks in advance, AJ