rapistrptime: R Wrappers for 'strptime', 'asPOSIXlt' etc

View source: R/datetime.R

rapistrptimeR Documentation

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.

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

Value

A vector with POSIXlt datetime objects

Author(s)

Dirk Eddelbuettel

Examples

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"))

RApiDatetime documentation built on Jan. 14, 2023, 5:06 p.m.