RcppCCTZ (version 0.2.12)

tzDiff: Return difference between two time zones at a given date.

Description

Difference between two given timezones at a specified date.

Usage

tzDiff(tzfrom, tzto, dt, verbose = FALSE)

Value

A numeric value with the difference (in hours) between the first and second time zone at the given date

Arguments

tzfrom

The first time zone as a character vector.

tzto

The second time zone as a character vector.

dt

A Datetime object specifying when the difference is to be computed.

verbose

A boolean toggle indicating whether more verbose operations are desired, default is FALSE.

Author

Dirk Eddelbuettel

Details

Time zone offsets vary by date, and this helper function computes the difference (in hours) between two time zones for a given date time.

Examples

Run this code
if (FALSE) {
# simple call: difference now
tzDiff("America/New_York", "Europe/London", Sys.time())
# tabulate difference for every week of the year
table(sapply(0:52, function(d) tzDiff("America/New_York", "Europe/London",
                                      as.POSIXct(as.Date("2016-01-01") + d*7))))
}

Run the code above in your browser using DataLab