R可以访问当前日期,时间和时区:
Sys.Date() # Returns date as a Date object ## [1] "2016-07-21" Sys.time() # Returns date & time at current locale as a POSIXct object ## [1] "2016-07-21 10:04:39 CDT" as.numeric(Sys.time()) # Seconds from UNIX Epoch (1970-01-01 00:00:00 UTC) ## [1] 1469113479 Sys.timezone() # Time zone at current location ## [1] "Australia/Melbourne"
用于OlsonNames()在当前系统上的Olson / IANA数据库中查看时区名称:
str(OlsonNames()) ## chr [1:589] "Africa/Abidjan" "Africa/Accra" "Africa/Addis_Ababa" "Africa/Algiers" "Africa/Asmara" "Africa/Asmera" "Africa/Bamako" ...