Learn R Programming

iso8601 (version 0.1.2)

iso8601totime: Convert time in ISO8601 format into R POSIXct object

Description

Convert time in ISO8601 format into R POSIXct object

Usage

iso8601totime(x)

Value

Returns a Time object, which is a subclass of POSIXct

object. Time is represented as a time on 1970-01-01. The only difference between the Time object and the POSIXct object is the formatting, which leaves out the date part.

Arguments

x

character vector of time strings

Details

Times are acceptes in any of the formats supported by ISO8601.

Examples

Run this code
iso8601totime(c("12:30:12", "T12", "T000910"))

iso8601totime("T16:15:14")
iso8601totime("T16:15:14,00")
iso8601totime("T16:15:14.00")
iso8601totime("T161514")
iso8601totime("T161514.00")
iso8601totime("T161514,00")
iso8601totime("T16:15:14,00")
iso8601totime("T16:15:14.00")
iso8601totime("T161514.00")
iso8601totime("T161514,00")
iso8601totime("T16:15.24")
iso8601totime("T16:15,24")
iso8601totime("T1615.24")
iso8601totime("T1615,24")
iso8601totime("T16.2539")
iso8601totime("T16,2539")

# T can be omitted
iso8601totime("16:15:14")
iso8601totime("16:15:14,00")
iso8601totime("16:15:14.00")
iso8601totime("16:15:14,00")
iso8601totime("16:15:14.00")
iso8601totime("16:15.24")
iso8601totime("16:15,24")
iso8601totime("161514")
iso8601totime("161514,00")
iso8601totime("161514.00")
iso8601totime("1615")
iso8601totime("1615")
iso8601totime("1615.24")
iso8601totime("1615,24")

Run the code above in your browser using DataLab