iso8601todate {iso8601}R Documentation

Convert date in ISO8601 format into R Date object

Description

Convert date in ISO8601 format into R Date object

Usage

iso8601todate(x, ndigitsyear = 4L)

Arguments

x

character vector of ISO8601 date string. When the string also contains a time part, this is ignored.

ndigitsyear

Number of digits used to encode the year. This should be an integer with values >= 4 with the same length as x or length one. When it is a vector with length greater than one, a different value is used for each element of x.

Details

Dates are accepted in any of the formats supported by ISO8601.

Value

Returns a Date object with the same length as x.

Examples

iso8601todate(c("2024-01-01", "2024-W01-1", "2024001", 
  "2024-01-01T12:30"))

iso8601todate("2019-08-17")
iso8601todate("2019-08")
iso8601todate("2019")
iso8601todate("20190817")
iso8601todate("2019-W33-6")
iso8601todate("2019-W33")
iso8601todate("2019W336")
iso8601todate("2019W33")
iso8601todate("2019-229")
iso8601todate("2019229")
iso8601todate("\u22120009-123")
iso8601todate("-0009")
iso8601todate("+002019-229", ndigitsyear = 6)


[Package iso8601 version 0.1.2 Index]