Format in ISO8601 character format
Arguments
- x
An object to convert to ISO8601 character format.
- usetz
Include the time zone in the formatting. If
usetz
isTRUE
, the time zone is included. Ifusetz
is"Z"
, the time is converted to "UTC" and the time zone is indicated with "Z" ISO8601 notation.- precision
The amount of precision to represent with substrings of "ymdhms", as "y"ear, "m"onth, "d"ay, "h"our, "m"inute, and "s"econd. (e.g. "ymdhm" would show precision through minutes. When
NULL
, full precision for the object is shown.- ...
Additional arguments to methods.
Examples
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 = "EST"), usetz = TRUE)
#> [1] "2018-02-01T03:04:05-0500"
format_ISO8601(as.POSIXct("2018-02-01 03:04:05", tz = "EST"), precision = "ymdhm")
#> [1] "2018-02-01T03:04"