EVOLUTION-MANAGER
Edit File: stri_datetime_add.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Date and Time Arithmetic</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for stri_datetime_add {stringi}"><tr><td>stri_datetime_add {stringi}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Date and Time Arithmetic</h2> <h3>Description</h3> <p>Modifies a date-time object by adding a specific amount of time units. </p> <h3>Usage</h3> <pre> stri_datetime_add( time, value = 1L, units = "seconds", tz = NULL, locale = NULL ) stri_datetime_add(time, units = "seconds", tz = NULL, locale = NULL) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>time</code></td> <td> <p>an object of class <code><a href="../../base/html/DateTimeClasses.html">POSIXct</a></code> or an object coercible to</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>integer vector; signed number of units to add to <code>time</code></p> </td></tr> <tr valign="top"><td><code>units</code></td> <td> <p>single string; one of <code>"years"</code>, <code>"months"</code>, <code>"weeks"</code>, <code>"days"</code>, <code>"hours"</code>, <code>"minutes"</code>, <code>"seconds"</code>, or <code>"milliseconds"</code></p> </td></tr> <tr valign="top"><td><code>tz</code></td> <td> <p><code>NULL</code> or <code>""</code> for the default time zone or a single string with a timezone identifier,</p> </td></tr> <tr valign="top"><td><code>locale</code></td> <td> <p><code>NULL</code> or <code>""</code> for default locale, or a single string with locale identifier; a non-Gregorian calendar may be specified by setting the <code>@calendar=name</code> keyword</p> </td></tr> </table> <h3>Details</h3> <p>Vectorized over <code>time</code> and <code>value</code>. </p> <p>Note that, e.g., January, 31 + 1 month = February, 28 or 29. </p> <h3>Value</h3> <p>Both functions return an object of class <code><a href="../../base/html/DateTimeClasses.html">POSIXct</a></code>. </p> <p>The replacement version of <code>stri_datetime_add</code> modifies the state of the <code>time</code> object. </p> <h3>References</h3> <p><em>Calendar Classes</em> - ICU User Guide, <a href="http://userguide.icu-project.org/datetime/calendar">http://userguide.icu-project.org/datetime/calendar</a> </p> <h3>See Also</h3> <p>Other datetime: <code><a href="stri_datetime_create.html">stri_datetime_create</a>()</code>, <code><a href="stri_datetime_fields.html">stri_datetime_fields</a>()</code>, <code><a href="stri_datetime_format.html">stri_datetime_format</a>()</code>, <code><a href="stri_datetime_fstr.html">stri_datetime_fstr</a>()</code>, <code><a href="stri_datetime_now.html">stri_datetime_now</a>()</code>, <code><a href="stri_datetime_symbols.html">stri_datetime_symbols</a>()</code>, <code><a href="stri_timezone_set.html">stri_timezone_get</a>()</code>, <code><a href="stri_timezone_info.html">stri_timezone_info</a>()</code>, <code><a href="stri_timezone_list.html">stri_timezone_list</a>()</code> </p> <h3>Examples</h3> <pre> 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") </pre> <hr /><div style="text-align: center;">[Package <em>stringi</em> version 1.4.6 <a href="00Index.html">Index</a>]</div> </body></html>