Sys.time
Get the Current Date, Time, or Time Zone

### Description

Retrieves the current date, time, or time zone or checks the time zone consistency of POSIXt objects.

### Usage

    Sys.time()
    Sys.Date()
    date()
    Sys.timezone()
    check_tzones(...)

### Arguments

... | objects of classes inherited from POSIXt.

### Details

Sys.Date, Sys.time, and Sys.timezone reflect the current system time zone setting (via the TZ environment variable), whereas date always use the default system time zone.
Value

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.

Differences between Spotfire Enterprise Runtime for R and Open-source R
Unlike open-source R, the return value of Spotfire Enterprise Runtime for R's Sys.timezone is platform-independent and matches the value returned in the Windows version of open-source R.
References
Time Zone. http://en.wikipedia.org/wiki/Timezone.
tz database. http://en.wikipedia.org/wiki/Tz_database.
Sources for time zone and daylight saving time data. http://cs.ucla.edu/~eggert/tz/tz-link.htm.
See Also
as.Date, POSIXt, proc.time
Examples

    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"))

Package base version 6.1.5-18
Package Index