Date and Time Arithmetic
Modifies a date-time object by adding a specific amount of time units.
stri_datetime_add( time, value = 1L, units = "seconds", tz = NULL, locale = NULL ) stri_datetime_add(time, units = "seconds", tz = NULL, locale = NULL) <- value
time |
an object of class |
value |
integer vector; signed number of units to add to |
units |
single string; one of |
tz |
|
locale |
|
Vectorized over time
and value
.
Note that, e.g., January, 31 + 1 month = February, 28 or 29.
Both functions return an object of class POSIXct
.
The replacement version of stri_datetime_add
modifies
the state of the time
object.
Calendar Classes - ICU User Guide, http://userguide.icu-project.org/datetime/calendar
Other datetime:
stri_datetime_create()
,
stri_datetime_fields()
,
stri_datetime_format()
,
stri_datetime_fstr()
,
stri_datetime_now()
,
stri_datetime_symbols()
,
stri_timezone_get()
,
stri_timezone_info()
,
stri_timezone_list()
x <- stri_datetime_now() stri_datetime_add(x, units='months') <- 2 print(x) stri_datetime_add(x, -2, units='months') stri_datetime_add(stri_datetime_create(2014, 4, 20), 1, units='years') stri_datetime_add(stri_datetime_create(2014, 4, 20), 1, units='years', locale='@calendar=hebrew') stri_datetime_add(stri_datetime_create(2016, 1, 31), 1, units='months')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.