Format a date in a fixed format that is ISO 8601 valid, and can be used to compare dates as character strings. It converts the date(s) to UTC.

format_iso_8601(date)

Arguments

date

The date(s) to format.

Value

Character vector of formatted dates.

Examples

format_iso_8601(parse_iso_8601("2013-02-08"))
#> [1] "2013-02-08T00:00:00+00:00"
format_iso_8601(parse_iso_8601("2013-02-08 09:34:00"))
#> [1] "2013-02-08T09:34:00+00:00"
format_iso_8601(parse_iso_8601("2013-02-08 09:34:00+01:00"))
#> [1] "2013-02-08T08:34:00+00:00"
format_iso_8601(parse_iso_8601("2013-W06-5"))
#> [1] "2013-02-08T00:00:00+00:00"
format_iso_8601(parse_iso_8601("2013-039"))
#> [1] "2013-02-08T00:00:00+00:00"