The ymd_hms function will left-pad date strings that are missing "seconds" values with "20". This only happens for some dates--can't seem to find a pattern.
library(lubridate)
# Generates NA, as expected
ymd_hms("2020-12-22 33:33")
#> Warning: All formats failed to parse. No formats found.
#> [1] NA
# Generates incorrect dates by left padding with "20"
ymd_hms("1901-12-22 12:33")
#> [1] "2019-01-12 22:12:33 UTC"
ymd_hms("2002-12-22 33:33")
#> [1] "2020-02-12 22:33:33 UTC"
ymd_hms("1801-12-22 12:33")
#> [1] "2018-01-12 22:12:33 UTC"
The
ymd_hms
function will left-pad date strings that are missing "seconds" values with"20"
. This only happens for some dates--can't seem to find a pattern.Created on 2024-01-05 with reprex v2.0.2