lubridate (version 0.1)

ymd_hms: Parse dates that appear in standard POSIXt order...

Description

Parse dates that appear in standard POSIXt order

Usage

ymd_hms(...)

Arguments

...
a character vector of dates in year, month, day, hour, minute, second format

Value

  • a vector of POSIXct date-time objects

Details

Transforms dates stored as character vectors in year, month, day, hour, minute, second format to POSIXct objects. ymd_hms() recognizes all non-alphanumeric separators of length 1 with the exception of ".". ymd_hms() automatically assigns the Universal Coordinated Time Zone (UTC) to the parsed date. This time zone can be changed with force_tz.

See Also

ymd, hms

Examples

Run this code
x <- c("2010-04-14-04-35-59", "2010-04-01-12-00-00")
ymd_hms(x)
# [1] "2010-04-14 04:35:59 UTC" "2010-04-01 12:00:00 UTC"
y <- c("2011-12-31 12:59:59", "2010-01-01 12:00:00")
ymd_hms(y)
# [1] "2011-12-31 12:59:59 UTC" "2010-01-01 12:00:00 UTC"}

Run the code above in your browser using DataLab