setTZ | R Documentation |
Set the time-zone information for dates and times.
setTZ(x, TZ, force.stz = FALSE)
x |
the date-time data, generally class "POSIXct." |
TZ |
time-zone code or time-zone name, see Details. |
force.stz |
force standard time specified in |
The time-zone information should be a standard name like those described in http://en.wikipedia.org/wiki/List_of_zoneinfo_time_zones. For the convenience of users in the United States, correct conversion is provided for the time-zone codes of EST, EDT, CST, CDT, MST, MDT, PST, PDT, AKST, AST, AKDT, ADT, HAST, and HST. However, time data in States like Arizona, where savings time is never used, would use time-zone information specified like " America/Phoenix" to avoid the possibility of setting savings time when it is not appropriate.
Data like x
, but with times adjusted by the time-zone information.
The time-zone information is a characterisitic of the data and not of
each individual value. If the data in x
come from different time
zones, then a time zone is selected from the data and used as the baseāthe
dates in x
are correctly converted to the selected time zone and a
warning is issued.
as.POSIXct
TestDts <- as.POSIXct(c("2010-05-28 09:50:00", "2010-11-29 15:20:00")) setTZ(TestDts, c("PDT", "PST")) # Try setting to different time zones setTZ(TestDts, c("PDT", "CST"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.