Learn R Programming

h2o (version 2.8.4.4)

h2o.setTimezone: Sets the time zone for the H2O client object.

Description

h2o.getTimezone, Sets the time zone for the H2O client object.

Usage

h2o.setTimezone(client, tz)

Arguments

client
An H2OClient object.
tz
A string that is the ID for a timezone, use h2o.listTimezones for appropriate ID.

Value

  • Returns the name of the time zone H2O is set to.

Details

Allows the user to set the time zone all Date features is relative to. By default H2O assumes that the Date is collected in the same time zone that H2O is running under. To change the time zone before importing a data frame or running as.Date on a column use h2o.setTimezone and to see a list of applicable time zones use h2o.listTimezones.

See Also

h2o.getTimezone, h2o.listTimezones, as.Date.H2OParsedData

Examples

Run this code
library(h2o)
localH2O = h2o.init()
# Check the Timezone listed
currentTimeZone = h2o.getTimezone(localH2O)
print(currentTimeZone)

dates = c("Fri Jan 10 00:00:00 1969",
          "Tue Jan 10 04:00:00 2068",
          "Mon Dec 30 01:00:00 2002",
          "Wed Jan 1 12:00:00 2003")
df = data.frame(dates)
hdf = as.h2o(localH2O, df, "hdf", TRUE)

# Returns Dates assuming PST
hdf$ca = as.Date(hdf$dates, "%c")
# Returns Dates assuming EST
# h2o.listTimezones(localH2O)
h2o.setTimezone(localH2O, tz = "EST")
hdf$nyc = as.Date(hdf$dates, "%c")
hdf

Run the code above in your browser using DataLab