I am trying to convert a unix epoch timestamps to a date-time object using as.POSIXct()
I need to specify timezones (either Europe/London or UTC) when I call as.POSIXct().
If I run
> t<-as.POSIXct(1445329330, tz="Europe/London", origin="1970-01-01")
> t
R returns
"2015-10-20 09:22:10 BST"
Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'default/Europe/London'
2: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'default/Europe/London'
I have tried specifying tz="BST", but this also returns warnings
Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'BST
'
2: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'default/Europe/London'
3: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'BST
'
4: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'default/Europe/London'
I have looked up the zoneinfo/zone.tab as per Joshua Ulrich's post and "Europe/London" does appear in the zone.tab file, while "BST" does not. So I think that Europe/London should be a valid tz option. Is this correct?
Does anyone have suggestions as to why I am getting warnings, and why the specified timezone is not being assigned to the as.POSIXct object?
It should be noted that my scripts which call as.POSIXct() were running without warnings prior to updating MacOS to High Sierra. Could the OS update lead to these warnings? When I run Sys.timezone() it returns NA
Many thanks in advance
Iris
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…