Question
Date and time zone conversion – ambiguous DST transition handling in as.POSIXct
Kavi Atlas
0 reputation · 14 May 2024, 11:52 UTC
17.5K views0
Date and time zone conversion in R
The goal is to reliably convert a character string such as "2021-11-07 01:30" to a POSIXct object while preserving the intended local time semantics, particularly around daylight‑saving transitions.
Current constraints and uncertainty
- When the
tzargument is omitted,as.POSIXctdefaults to the system time zone, producing non‑portable results. - During the fall‑back transition, the local time 01:30 occurs twice. R’s default behaviour is to map the string to the earlier instance, but this is undocumented and may vary across releases.
- Unsupported abbreviations like "PST" are silently ignored, potentially yielding UTC values without warning.
These ambiguities make it hard to write reproducible code that behaves consistently on all machines.
Specific questions for clarification
- Which instance (earlier or later) does
as.POSIXctreturn for an ambiguous time such as "2021-11-07 01:30" in the America/New_York zone? - Is there a documented or configurable option to explicitly choose the later instance during DST fall‑back?
- Will future R releases standardise this behaviour, or is it expected to remain implementation‑dependent?