Learn R Programming

tind (version 0.2.4)

current-date-time: Current Date and Time

Description

today returns the current date and now returns the current date and time (in the system time zone or the time zone provided by the user).

Usage

today(tz = NULL)

now(tz = NULL, digits = 0)

Value

today and now return an object of class tind

of length 1 and type "d" (date) and "t" (date-time), respectively.

Arguments

tz

(optional) a character value determining the time zone (the default NULL is interpreted as the system time zone). See tzone documentation for information on time zones.

digits

an integer value giving the number of decimal places for seconds (0--6, 0 by default).

Examples

Run this code
today()
now()
# millisecond accuracy
now(digits = 3)
# check current date and time in different time zones
if ("Asia/Tokyo" %in% OlsonNames()) {
now("Asia/Tokyo")
today("Asia/Tokyo")
}
if ("Europe/Warsaw" %in% OlsonNames()) {
now("Europe/Warsaw")
today("Europe/Warsaw")
}
if ("America/New_York" %in% OlsonNames()) {
now("America/New_York")
today("America/New_York")
}

Run the code above in your browser using DataLab