stats-update: Update a timeDate object

update.timeDateR Documentation

Update a timeDate object

Description

Update a ‘timeDate’ object.

Usage

## S3 method for class 'timeDate'
update(object, zone = NULL, FinCenter = zone, dst_gap = "+", ...)

Arguments

object

a "timeDate" object.

zone

a character string, the time zone or financial center where the data were recorded, see section ‘Details’.

FinCenter

a character string, a time zone or financial center.

dst_gap

a character string specifying what to do with non-existent times falling in a DST gap, see timeDate.

...

Ignored.

Details

Argument zone requests to change the datetimes, so that if the slot FinCenter of the modified object is set to zone, the printed times will be (almost) the same as those of the input object. This is useful, for example, when we want to reset the time zone of timedates returned by other functions. For example, most functions in this package return holidays in GMT time zone but users may prefer them in their time zone.

The qualifier ‘almost’ in the above paragraph is needed because some datetimes in object may not exist in the target zone if DST is in operation.

If zone is not NULL, it must be a character string designating one of the supported time zones or financial centers. It can also be the empty string, in which case the zone is set to the value returned by getRmetricsOptions("myFinCenter").

Argument FinCenter can be used to set the FinCenter slot of the returned object. The defult is to zone if that is not null NULL, otherwise the FinCenter slot of the result will be left as is.

See also the "character" method of timeDate.

You can reduce the need for updates of this kind by setting suitable Rmetrics options, see the examples.

Value

an object of class "timeDate"

Note

Currently this method is mainly useful to reset the zone. Suggestions for other features that can be usefully updated are welcome.

Author(s)

Georgi N. Boshnakov

See Also

timeDate

Examples

## New Years Day
ea1 <- NewYearsDay(2026)
ea1

cat("What is the time in Jamaica when New Year arrives in ", finCenter(ea1), "?\n")
ea2 <- ea1
ea2@FinCenter <- "Jamaica"
ea2

## New Years Day in Jamaica
ea3 <- update(ea1, zone = "Jamaica")
ea3

## set the Rmetrics option "myFinCenter" to get most results directly in it.
savop <- getRmetricsOptions("myFinCenter")

setRmetricsOptions(myFinCenter = "Jamaica")
NewYearsDay(2026) # the result is directly for Jamaica

## restore the previous value of the option
setRmetricsOptions(myFinCenter = savop)

timeDate documentation built on Oct. 13, 2026, 3:02 a.m.