tz

0th

Percentile

Get/set time zone component of a date-time.

Get/set time zone component of a date-time.

Keywords
manip, methods, utilities, chron
Usage
tz(x)
Arguments
x
a date-time object
Details

Date-time must be a POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts objects.

Setting tz does not update a date-time to display the same moment as measured at a different time zone. See with_tz. Setting a new time zone creates a new date-time. The numerical value of the hours element stays the same, only the time zone attribute is replaced. This creates a new date-time that occurs an integer value of hours before or after the original date-time.

If x is of a class that displays all date-times in the GMT timezone, such as chron, then R will update the number in the hours element to display the new date-time in the GMT timezone.

For a description of the time zone attribute, see DateTimeClasses.

Value

  • the first element of x's tzone attribute vector as a character string. If no tzone attribute exists, tz returns "GMT".

Aliases
  • tz
  • tz.default
  • tz.zoo
  • tz.its
  • tz.ti
  • tz.timeseries
  • tz.fts
  • tz.irts
  • tz<-
  • tz<-.default
  • tz.timeSeries
  • tz<-.chron
  • tz<-.zoo
  • tz<-.its
  • tz<-.ti
  • tz<-.timeDate
  • tz<-.jul
  • tz<-.timeSeries
  • tz<-.fts
  • tz<-.irts
Examples
x <- now()
tz(x) 
tz(x) <- "GMT"  
x
tz(x) <- "America/New_York"
x
Sys.setenv(TZ = "GMT")
x
tz(x)
Sys.unsetenv("TZ")
Documentation reproduced from package lubridate, version 0.1, License: GPL

Community examples

Looks like there are no examples yet.