Skip to contents

Normalizes Date, POSIXct, or ISO 8601 strings into canonical UTC strings with trailing Z. Supported inputs are:

  • Date (interpreted as midnight UTC)

  • POSIXct/POSIXt

  • "YYYY-MM-DD"

  • "YYYY-MM-DDTHH:MM:SS"

  • "YYYY-MM-DDTHH:MM:SSZ"

Usage

iso_utc(x)

Arguments

x

A timestamp to normalize.

Value

A length-1 character string in ISO 8601 UTC format.

Examples

iso_utc("2020-01-01")
#> [1] "2020-01-01T00:00:00Z"
iso_utc(as.POSIXct("2020-01-01 09:30:00", tz = "UTC"))
#> [1] "2020-01-01T09:30:00Z"