Sys.time() Sys.Date() date() Sys.timezone() check_tzones(...)
... | objects of classes inherited from POSIXt. |
Sys.time | returns a POSIXct object representing the current date and time for the current system time zone. |
Sys.Date | returns a Date object representing the current date for the current system time zone. |
date | returns a character string representing the current date and time for the default system time zone. |
Sys.timezone | returns a character string representing the current system time zone (not including the current daylight/standard time status). |
check_tzones | returns the time zone string of the first object in .... Warns if the time zones are not consistent. |
Sys.setenv(TZ = "") Sys.time(); Sys.Date(); Sys.timezone() Sys.setenv(TZ = "Asia/Shanghai") Sys.time(); Sys.Date(); Sys.timezone() Sys.setenv(TZ = "")cat('Analysis started ', date(), '...\n', sep='') # Now perform multi-hour analysis... cat('Analysis completed ', date(), '.\n', sep='')
x <- Sys.time() check_tzones(x) check_tzones(as.POSIXlt(x, tz = "Asia/Shanghai")) check_tzones(as.POSIXlt(x, tz = "nosuchtimezone")) check_tzones(as.POSIXlt(x, tz = "Asia/Shanghai"), as.POSIXlt(x, tz = "America/New_York"))