Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stri_datetime_create

Create a Date-Time Object


Description

Constructs date-time objects from numeric representations.

Usage

stri_datetime_create(
  year,
  month,
  day,
  hour = 12L,
  minute = 0L,
  second = 0,
  lenient = FALSE,
  tz = NULL,
  locale = NULL
)

Arguments

year

integer vector; 0 is 1BC, -1 is 2BC, etc.

month

integer vector; months are 1-based

day

integer vector

hour

integer vector

minute

integer vector

second

numeric vector; fractional seconds are allowed

lenient

single logical value; should the operation be lenient?

tz

NULL or '' for the default time zone or a single string with time zone identifier, see stri_timezone_list

locale

NULL or '' for default locale, or a single string with locale identifier; a non-Gregorian calendar may be specified by setting @calendar=name keyword

Details

Vectorized over year, month, day, hour, hour, minute, and second.

Value

Returns an object of class POSIXct.

See Also

Examples

stri_datetime_create(2015, 12, 31, 23, 59, 59.999)
stri_datetime_create(5775, 8, 1, locale='@calendar=hebrew') # 1 Nisan 5775 -> 2015-03-21
stri_datetime_create(2015, 02, 29)
stri_datetime_create(2015, 02, 29, lenient=TRUE)

stringi

Character String Processing Facilities

v1.6.1
file LICENSE
Authors
Marek Gagolewski [aut, cre, cph] (<https://orcid.org/0000-0003-0637-6028>), Bartek Tartanus [ctb], and others (stringi source code); IBM, Unicode, Inc. and others (ICU4C source code, Unicode Character Database)
Initial release
2021-05-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.