rguides

now

Signature and Parameters

now(tzone = "")

now() accepts a single argument:

ParameterTypeDefaultDescription
tzonecharacter"" (empty string)An IANA timezone string. Defaults to your machine’s system timezone.

Valid timezone strings include "UTC", "America/New_York", "Europe/London", and "GMT". Passing "" (the default) uses the system timezone.

Return Value

Returns a single-length POSIXct vector representing the current instant. The returned object has class c("POSIXct", "POSIXt") and base type double — the underlying value is seconds since the Unix epoch (1970-01-01 00:00:00 UTC).

library(lubridate)

class(now())
# [1] "POSIXct" "POSIXt"

typeof(now())
# [1] "double"

The tzone attribute of the returned object reflects the requested timezone.

Timezones

By default, now() uses your machine’s local timezone. It is not guaranteed to return UTC.

library(lubridate)

# System timezone (default)
now()
# [1] "2026-03-20 09:12:00 EDT"

# Explicit UTC
now("UTC")
# [1] "2026-03-20 13:12:00 UTC"

# Named timezone
now("America/New_York")
# [1] "2026-03-20 09:12:00 EDT"

now("UTC") and now("America/New_York") represent the same instant in time. Only the printed display differs. Comparisons between them work correctly because the underlying numeric representation is absolute.

now("UTC") == now("America/New_York")
# [1] TRUE

Passing an invalid timezone string raises an error. Always validate timezone strings before use if they come from user input.

Extracting Components

now() returns a POSIXct, so it composes directly with lubridate’s extractor functions:

library(lubridate)

t <- now("UTC")
year(t)      # 2026
month(t)     # 3
day(t)       # 20
hour(t)      # 9
minute(t)    # 12
second(t)    # 0
wday(t)      # 6 (Friday, locale-dependent)
tz(t)        # "UTC"

No conversion step is required — pass the POSIXct returned by now() directly.

Time Arithmetic

now() returns a POSIXct, so you can add or subtract periods directly:

library(lubridate)

t <- now("UTC")
t
# [1] "2026-03-20 09:12:00 UTC"

t - hours(1)
# [1] "2026-03-20 08:12:00 UTC"

t + days(1)
# [1] "2026-03-21 09:12:00 UTC"

floor_date(t, unit = "day")
# [1] "2026-03-20 00:00:00 UTC"

Use floor_date(), ceiling_date(), or round_date() to align to time boundaries.

Common Gotchas

Two calls are never equal

now() == now() is always FALSE. Each call captures a distinct instant.

now() == now()
# [1] FALSE

Wall-clock time, not monotonic time

now() is based on system time, which can jump due to NTP adjustments or manual clock changes. For measuring elapsed time, use base Sys.time() or the tictoc package.

Timezone is a display property

now("UTC") and now("America/New_York") have the same underlying numeric value. The tzone attribute controls only how that value is printed, not the instant itself.

now("UTC") == now("America/New_York")
# [1] TRUE

today() vs now() timezone behaviour differs

Because today() returns a Date (no time component), today() == today("GMT") can be FALSE if your local time is behind GMT and the UTC “today” has already rolled over to the next calendar day. now() does not have this issue.

See Also

  • lubridate::ymd — parse dates from character or numeric input; pairs well with now() when constructing timestamps
  • dplyr::filter() — row selection in tidyverse pipelines; commonly used after now() to filter time-based records