time_update {timechange} | R Documentation |
time_update
returns a date-time with the specified elements updated.
Elements not specified will be left unchanged.
time_update(time, updates = NULL, year = NULL, month = NULL, yday = NULL, day = NULL, mday = NULL, wday = NULL, hour = NULL, minute = NULL, second = NULL, tz = NULL, roll_month = "last", roll_dst = "boundary", week_start = getOption("week_start", 1))
time |
a date-time object |
updates |
a string specification of components to be updated (not implemented yet) or a named list of components. |
year, month, yday, wday, mday, day, hour, minute, second |
components of the
date-time to be updated. |
tz |
time zone component (a singleton character vector) |
roll_month, roll_dst |
See |
week_start |
week starting day (Default is 1, Monday). Set |
a date object with the requested elements updated. The object will
retain its original class unless the original class is Date
and at least
one of the hour
, minute
, second
or tz
is supplied, in which case a
POSIXct
object is returned.
date <- as.Date("2009-02-10") time_update(date, year = 2010, month = 1, mday = 1) time_update(date, year = 2010, month = 13, mday = 1) time_update(date, minute = 10, second = 3) time_update(date, minute = 10, second = 3, tz = "America/New_York")