now: The current day and time

Description Usage Arguments Value Examples

View source: R/instants.r

Description

The current day and time

Usage

1
2
3
now(tzone = "")

today(tzone = "")

Arguments

tzone

a character vector specifying which time zone you would like the current time in. tzone defaults to your computer's system timezone. You can retrieve the current time in the Universal Coordinated Time (UTC) with now("UTC").

Value

now - the current datetime as a POSIXct object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
now()
now("GMT")
now("")
now() == now() # would be TRUE if computer processed both at the same instant
now() < now() # TRUE
now() > now() # FALSE
today()
today("GMT")
today() == today("GMT") # not always true
today() < as.Date("2999-01-01") # TRUE  (so far)

Example output

Attaching package: 'lubridate'

The following object is masked from 'package:base':

    date

sh: 1: cannot create /dev/null: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : cannot open file '/etc/timezone': Permission denied
Warning: Your system is mis-configured: '/etc/localtime' is not a symlink
sh: 1: cannot create /dev/null: Permission denied
[1] "2020-05-19 14:44:25 UTC"
Warning message:
In C_valid_tz(tzone) :
  System timezone name is unknown. Please set environment variable TZ.
[1] "2020-05-19 14:44:25 GMT"
[1] "2020-05-19 14:44:25 UTC"
[1] FALSE
[1] TRUE
[1] FALSE
[1] "2020-05-19"
[1] "2020-05-19"
[1] TRUE
[1] TRUE

lubridate documentation built on Feb. 26, 2021, 5:09 p.m.