奇怪的 as.POSIXct 行为取决于夏令时
Weird as.POSIXct behavior depending on daylight savings time
as.POSIXct 中似乎有错误。或者是怎么回事?
as.POSIXct("27/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S")
[1] "2006-03-27 02:05:38 CEST"
as.POSIXct("26/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S")
[1] NA
据我所知,2006 年 3 月 26 日发生了...
如果你真的想要它印上你随时可以做的时间。
as.POSIXct("26/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S", tz = "UTC")
#[1] "2006-03-26 02:05:38 UTC"
只需确保对所有转化都执行此操作以保持一致性。
如Wikipedia所述:
UTC does not change with a change of seasons, but local time or civil
time may change if a time zone jurisdiction observes daylight saving
time (summer time). For example, local time on the east coast of the
United States is five hours behind UTC during winter, but four hours
behind while daylight saving is observed there.
as.POSIXct 中似乎有错误。或者是怎么回事?
as.POSIXct("27/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S")
[1] "2006-03-27 02:05:38 CEST"
as.POSIXct("26/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S")
[1] NA
据我所知,2006 年 3 月 26 日发生了...
如果你真的想要它印上你随时可以做的时间。
as.POSIXct("26/03/2006 02:05:38", format="%d/%m/%Y %H:%M:%S", tz = "UTC")
#[1] "2006-03-26 02:05:38 UTC"
只需确保对所有转化都执行此操作以保持一致性。
如Wikipedia所述:
UTC does not change with a change of seasons, but local time or civil time may change if a time zone jurisdiction observes daylight saving time (summer time). For example, local time on the east coast of the United States is five hours behind UTC during winter, but four hours behind while daylight saving is observed there.