ID EN
Environment & Scope

Sys.time

R Base 3.6.2

Sys.time and Sys.Date returns the system's idea of the current date with and without time.

Syntax

R
Sys.time()
Sys.Date()

Return Value

Sys.time returns an object of class "POSIXct" (see DateTimeClasses). On almost all systems it will have sub-second accuracy, possibly microseconds or better. On Windows it increments in clock ticks (usually 1/60 of a second) reported to millisecond accuracy. Sys.Date returns an object of class "Date" (see Date).

Details

Sys.time returns an absolute date-time value which can be converted to various time zones and may return different days. Sys.Date returns the current day in the current time zone.

Examples

Example
R
# NOT RUN {
Sys.time()
## print with possibly greater accuracy:
op <- options(digits.secs = 6)
Sys.time()
options(op)

## locale-specific version of date()
format(Sys.time(), "%a %b %d %X %Y")

Sys.Date()
# }

See Also

date for the system time in a fixed-format character string. Sys.timezone. system.time for measuring elapsed/CPU time of expressions.