I need to write some codes to convert the data time from other timezone to local for different users in the world.
The function Sys.timezone() will return the abbreviation with three characters. For example,
> Sys.timezone()
"EST"
EST stands for Eastern Standard Time (-5), but my computer actually is Australian Eastern Standard Time (AEST, +10, Australia/Brisbane). This code will return wrong result
> as.POSIXct(as.numeric(Sys.time()), origin = '1970-1-1', tz = Sys.timezone())
"2013-11-20 02:17:12 EST"
The actual time is
Sys.time() "2013-11-20 17:17:12 EST"
My question is how to get the system time zone with the Country/City name?
PS: Why does R use EST for Eastern Standard Time (-5) and Australian Eastern Standard Time (+10)?
sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base