lubridate (version 0.2.1)

parse_date: Change dates into a POSIXct format...

Description

Change dates into a POSIXct format

Usage

parse_date(x, formats, seps=find_separator(x))

Arguments

x
a character or numeric vector of suspected dates
formats
a vector of date-time format elements in the order they occur within the dates. See strptime for format elements.
seps
a vector of possible characters used to separate elements within the dates.

Value

  • a vector of POSIXct date-time objects

Details

parse_date is an internal function for the ymd family of functions. Its recommended to use these functions instead. It transforms dates stored in character and numeric vectors to POSIXct objects. All inputed dates are considered to have the same order and to use the same separator.

See Also

ymd

Examples

Run this code
x <- c("09-01-01", "09-01-02", "09-01-03")
parse_date(x, c("%y", "%m", "%d"), seps = "-")
#  "2009-01-01 UTC" "2009-01-02 UTC" "2009-01-03 UTC"
ymd(x)
#  "2009-01-01 UTC" "2009-01-02 UTC" "2009-01-03 UTC"}

Run the code above in your browser using DataCamp Workspace