Oce Version of as.POSIXct

Share:

Description

Oce Version of as.POSIXct

Usage

1
decodeTime(time, timeFormats, tz = "UTC")

Arguments

time

Character string with an indication of the time.

timeFormats

Optional vector of time formats to use, as for as.POSIXct.

tz

Time zone.

Details

Each format in timeFormats is used in turn as the format argument to as.POSIXct, and the first that produces a non-NA result is used. If timeFormats is missing, the following formats are tried, in the stated order:

  • "%b %d %Y %H:%M:%S" (e.g. "Jul 1 2013 01:02:03")

  • "%b %d %Y" (e.g. "Jul 1 2013")

  • "%B %d %Y %H:%M:%S" (e.g. "July 1 2013 01:02:03")

  • "%B %d %Y" (e.g. "July 1 2013")

  • "%d %b %Y %H:%M:%S" (e.g. "1 Jul 2013 01:02:03")

  • "%d %b %Y" (e.g. "1 Jul 2013")

  • "%d %B %Y %H:%M:%S" (e.g. "1 July 2013 01:02:03")

  • "%d %B %Y" (e.g. "1 July 2013")

  • "%Y-%m-%d %H:%M:%S" (e.g. "2013-07-01 01:02:03")

  • "%Y-%m-%d" (e.g. "2013-07-01")

  • "%Y-%b-%d %H:%M:%S" (e.g. "2013-July-01 01:02:03")

  • "%Y-%b-%d" (e.g. "2013-Jul-01")

  • "%Y-%B-%d %H:%M:%S" (e.g. "2013-July-01 01:02:03")

  • "%Y-%B-%d" (e.g. "2013-July-01")

  • "%d-%b-%Y %H:%M:%S" (e.g. "01-Jul-2013 01:02:03")

  • "%d-%b-%Y" (e.g. "01-Jul-2013")

  • "%d-%B-%Y %H:%M:%S" (e.g. "01-July-2013 01:02:03")

  • "%d-%B-%Y" (e.g. "01-July-2013")

  • "%Y/%b/%d %H:%M:%S" (e.g. "2013/Jul/01 01:02:03")

  • "%Y/%b/%d" (e.g. "2013/Jul/01")

  • "%Y/%B/%d %H:%M:%S" (e.g. "2013/July/01 01:02:03")

  • "%Y/%B/%d" (e.g. "2013/July/01")

  • "%Y/%m/%d %H:%M:%S" (e.g. "2013/07/01 01:02:03")

  • "%Y/%m/%d" (e.g. "2013/07/01")

Value

A time as returned by as.POSIXct.

Author(s)

Dan Kelley

See Also

Other functions relating to time: GMTOffsetFromTz

Examples

1
2
3
4
5
6
7
decodeTime("July 1 2013 01:02:03")
decodeTime("Jul 1 2013 01:02:03")
decodeTime("1 July 2013 01:02:03")
decodeTime("1 Jul 2013 01:02:03")
decodeTime("2013-07-01 01:02:03")
decodeTime("2013/07/01 01:02:03")
decodeTime("2013/07/01")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.