Skip to contents

Returns the current system time formatted as a character string.

Usage

now_c(format = "%Y-%m-%d %H:%M:%S")

Arguments

format

A format string passed to base::format(). Defaults to "%Y-%m-%d %H:%M:%S".

Value

The current time as a single character string.

Details

The current time is taken from base::Sys.time() and formatted with the supplied format string, which uses the conversion codes documented in base::strptime().

The result depends on the time zone of the session. At one instant, a session in Pacific/Auckland and a session in America/Los_Angeles can report different calendar dates, not only different clock times.

See also

date_to_isoyearweek_c() to convert a date rather than to read the clock. No vignette runs this function.

Examples

now_c()
#> [1] "2026-08-06 09:36:49"
now_c(format = "%Y-%m-%d")
#> [1] "2026-08-06"