I want to convert the following format into a standard date format in R:
2013-05-22 02:00pm
to
2013-05-22 14:00
I've tried using strptime, but it outputs 2013-05-22 02:00 MST
, which would mean 2AM. How do I fix this?
I want to convert the following format into a standard date format in R:
2013-05-22 02:00pm
to
2013-05-22 14:00
I've tried using strptime, but it outputs 2013-05-22 02:00 MST
, which would mean 2AM. How do I fix this?
?strptime
says you must use "%I"
(not "%H"
) with "%p"
.
> strptime('2013-05-22 02:00pm', tz="UTC", format="%Y-%m-%d %I:%M%p")
[1] "2013-05-22 14:00:00 UTC"