I have a character string that gives a date and an a time stamp in the MDY-HMS format
"12/14/23 12:00:00 AM"
When I use the mdy_hms
function in lubridate
to re-format the string as YMD-HMS, the timestamp is gone.
What can be done to make sure that the midnight timestamp is preserved?
When I use the mdy_hms
function in lubridate
to re-format the string as YMD-HMS, the timestamp is gone.
mdy_hms("12/14/23 12:00:00 AM")
"2023-12-14 UTC"
I've tested the mdy_hms function by replace the 12 in the hour as 00 and it gives the same result, but when the timestamp portion of the string is either 12:01:00 AM or 00:01:00 AM, the timestamp is preserved.
mdy_hms("12/14/23 12:01:00 AM")
"2023-12-14 00:01:00 UTC"
"2023-12-14 00:01:00 UTC"
I want the output to be "2023-12-14 00:00:00 UTC"