| mode_tz {datetimeoffset} | R Documentation | 
Get most common time zone
Description
'mode_tz()' gets the most common time zone in the datetime object. If a tie we use the time zone used first. Intended for use when coercing from a datetime object that supports multiple heterogeneous time zones to a datetime object that only supports one time zone
Usage
mode_tz(x, ...)
## S3 method for class 'datetimeoffset'
mode_tz(x, tz = "", ...)
## Default S3 method:
mode_tz(x, ...)
Arguments
| x | A datetime object. | 
| ... | Ignored | 
| tz | A timezone string to use for missing time zones.
"" will be treated as equivalent to  | 
Value
Timezone string
Examples
  dt <- as_datetimeoffset(Sys.time())
  print(mode_tz(dt))
  if (all(c("America/Los_Angeles", "America/New_York") %in% OlsonNames())) {
    dt <- as_datetimeoffset("2020-01-01",
                             tz = c("America/Los_Angeles", "America/New_York"))
    print(mode_tz(dt))
    print(Sys.timezone()) # timezone to be used for missing time zones
    dt <- as_datetimeoffset("2020-01-01",
                             tz = c("America/New_York", NA_character_, NA_character_))
    print(mode_tz(dt))
  }
[Package datetimeoffset version 0.3.1 Index]