Question Details

No question body available.

Tags

r posixlt

Answers (1)

Accepted Answer Available
Accepted Answer
September 2, 2025 Score: 38 Rep: 209,817 Quality: Expert Completeness: 80%

I can reproduce the error on my machine with

as.POSIXct("1994-01-01", tz="America/Lima")

Error in as.POSIXlt.character(x, tz, ...) :

character string is not in a standard unambiguous format

If we check timezonedb for the America/Lima time zone we can see several adjustments made to that timezone over the years, including this one

After Friday, 31 December, 1993 11:59:59 PM: Clocks were moved forward to become Saturday, 01 January, 1994 01:00:00 AM

This basically means that midnight did not exist on Jan 1, 1994 in that timezone. That day began at 1am. When R is parsing date/times values like "1994-01-01", it implicitly assumes that you are using midnight as the time for that date.

Because humans can change how time zones work, there are just some date/time combinations that aren't valid. And you found one of the few where that's the case. It doesn't look like any change have been made to the timezone since 1994 so hopefully things won't be as messy in the future.

If you don't need time information, you can parse the value as just a date with

as.Date("1994-01-01")