toTz: Shift datetime object from one timezone to another

View source: R/RcppExports.R

toTzR Documentation

Shift datetime object from one timezone to another

Description

Change from one given timezone to another.

Usage

toTz(dtv, tzfrom, tzto, verbose = FALSE)

Arguments

dtv

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

tzfrom

The first time zone as a character vector.

tzto

The second time zone as a character vector.

verbose

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

Details

Time zone offsets vary by date, and this helper function converts a Datetime object from one given timezone to another.

Value

A DatetimeVector object with the given (civil time) determined by the incoming object (and its timezone) shifted to the target timezone.

Author(s)

Dirk Eddelbuettel

Examples

## Not run: 
toTz(Sys.time(), "America/New_York", "Europe/London")
# this redoes the 'Armstrong on the moon in NYC and Sydney' example
toTz(ISOdatetime(1969,7,20,22,56,0,tz="UTC"), "America/New_York", "Australia/Sydney", verbose=TRUE)
# we can also explicitly format for Sydney time 
format(toTz(ISOdatetime(1969,7,20,22,56,0,tz="UTC"), 
            "America/New_York", "Australia/Sydney", verbose=TRUE), 
       tz="Australia/Sydney")

## End(Not run)

RcppCCTZ documentation built on Nov. 10, 2022, 5:52 p.m.