Format in ISO8601 character format
format_ISO8601(x, usetz = FALSE, precision = NULL, ...)
An object to convert to ISO8601 character format.
Include the time zone in the formatting. If
usetz
is TRUE
, the time zone is included. If
usetz
is "Z"
, the time is converted to "UTC" and
the time zone is indicated with "Z" ISO8601 notation.
The amount of precision to represent with
substrings of "ymdhms", as year, month, day, hour,
minute, and second. (e.g. "ymd" is days precision, "ymdhm" is minute precision.
When NULL
, full precision for the object
is shown.
Additional arguments to methods.
A character vector of ISO8601-formatted text.
format_ISO8601(as.Date("02-01-2018", format = "%m-%d-%Y"))
#> [1] "2018-02-01"
format_ISO8601(as.POSIXct("2018-02-01 03:04:05", tz = "America/New_York"), usetz = TRUE)
#> [1] "2018-02-01T03:04:05-0500"
format_ISO8601(as.POSIXct("2018-02-01 03:04:05", tz = "America/New_York"), precision = "ymdhm")
#> [1] "2018-02-01T03:04"