tzinfo {tzinfo}R Documentation

Functions for dealing with time zones

Description

locaton2tz determines the time zone at a given location

tzoffset returns the offset (in seconds) from GMT for the given time zone

location2offset determines the time zone at a given location and returns its offset

Usage

location2tz(lat, lon)
location2offset(lat, lon, base="2017-01-01")
tzoffset(tzname, base="2017-01-01")

Arguments

lat

numeric, latitudes of the points

lon

numeric, longitude of the points

base

string, base date/time to use for offset calculation - only relevant if DST is observed in the time zone

tzname

character vector, name of the time zones (as returned from location2tz)

Details

location2tz uses the time zone shape file to look up the time zone at the desired points.

tzoffset uses the system facilities (essentially as.POSIXct(base, tz)) to determine the offset in the provided time zone.

location2offset is essentially tzoffset(location2tz(...)).

Value

location2tz: character vector of time zone names or NA if the point is in international waters.

tzoffset, location2offset: numeric vector with offset in seconds or NA if a time zone is not recognized by the system (or location2tz return NA for the points).

Note

The time zone shapefile is based on https://github.com/evansiroky/timezone-boundary-builder, in particular 2017a release of the shapefile.

Author(s)

Simon Urbanek

Examples

  location2tz(c(41, 41), c(-90, -76))
  tzoffset("America/New_York")
  location2offset(c(41, 41), c(-90, -76)) ## without DST
  location2offset(c(41, 41), c(-90, -76), "2017-06-01") ## with DST

[Package tzinfo version 0.1-0 Index]