timeconv: Convert from one time zone to another.

timeConvertR Documentation

Convert from one time zone to another.

Description

Converts a time/date object from one time zone to another.

Usage

timeConvert(x, to.zone, from.zone)

Arguments

x

the time/date object to convert.

to.zone

the time zone to convert to (character).

from.zone

the time zone to convert from (character). For timeDate objects, this is ignored. Instead, the value is taken from the time.zone slot of the timeDate object.

Details

The timeDate stores times/dates as their equivalent time in GMT, with a time zone (used for printing and other operations) stored in the time.zone slot. Therefore, to convert time zones, this function simply puts the new time zone into the time.zone slot.

Value

returns the time/date object reflecting the converted time zone.

See Also

timeZoneConvert.

Examples

timeDateOptions(time.zone="GMT",
  time.in.format="%m/%d/%Y [%H:%M]",
  time.out.format="%m/%d/%Y %02H:%02M (%Z)")
date1 <- timeDate("3/22/2002 12:00", zone="PST")
date1 
## 3/22/2002 12:00 (PST)
date2 <- timeConvert(date1, "EST")
date2 # converted to EST
## 3/22/2002 15:00 (EST)

splusTimeDate documentation built on July 7, 2022, 5:05 p.m.