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
|
integer vector; 0 is 1BC, -1 is 2BC, etc. |
|
integer vector; months are 1-based |
|
integer vector |
|
integer vector |
|
integer vector |
|
numeric vector; fractional seconds are allowed |
|
single logical value; should the operation be lenient? |
|
|
|
|
Details
Vectorized over year
, month
, day
, hour
, hour
, minute
, and second
.
Value
Returns an object of class POSIXct
.
See Also
The official online manual of stringi at https://stringi.gagolewski.com/
Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, doi:10.18637/jss.v103.i02
Other datetime: stri_datetime_add()
, stri_datetime_fields()
, stri_datetime_format()
, stri_datetime_fstr()
, stri_datetime_now()
, stri_datetime_symbols()
, stri_timezone_get()
, stri_timezone_info()
, stri_timezone_list()
Examples
stri_datetime_create(2015, 12, 31, 23, 59, 59.999)
## [1] "2015-12-31 23:59:59 AEDT"
stri_datetime_create(5775, 8, 1, locale='@calendar=hebrew') # 1 Nisan 5775 -> 2015-03-21
## [1] "2015-03-21 12:00:00 AEDT"
stri_datetime_create(2015, 02, 29)
## [1] NA
stri_datetime_create(2015, 02, 29, lenient=TRUE)
## [1] "2015-03-01 12:00:00 AEDT"