RApiDatetime (version 0.0.4)

rapistrptime: R Wrappers for strptime, asPOSIXlt etc

Description

Wrappers for C-level strptime etc functions

Usage

rapistrptime(x, fmt, tz = "")

rapiAsPOSIXlt(x, tz = "")

rapiAsPOSIXct(x, tz = "")

rapiFormatPOSIXlt(x, fmt, usetz = FALSE)

rapiPOSIXlt2D(x)

rapiD2POSIXlt(x)

Arguments

x

Vector with one or character elements to be parsed

fmt

The format string, see help("strptime") for details.

tz

An optional timezone string

usetz

An optional logical variable selecting use of the timezone.

Value

A vector with POSIXlt datetime objects

Details

These functions provide (additional) entry points from R to the C-level function of the R API. They are provided here mainly for testing (the C level access) as R itself exposes the function

Examples

Run this code
# NOT RUN {
op <- options(digits.secs=6)
x <- rapistrptime("2017-01-02 03:04:05.678", "%Y-%m-%d %H:%M:%OS")
format(x)
rapiAsPOSIXlt(as.POSIXct(x))
rapiAsPOSIXct(x)
rapiFormatPOSIXlt(x, "%Y-%b-%d %H:%M:%OS")
options(op)
rapiPOSIXlt2D(x)
rapiD2POSIXlt(as.Date("2017-01-02"))
# }

Run the code above in your browser using DataCamp Workspace