extracts the timezone attribute from POSIXct with default on missing

getTZone(x, default = "GMT")

Arguments

x

POSIXct vector

default

time zone returned, if x has not timezone associated or attribute is the zero string

Author

Department for Biogeochemical Integration at MPI-BGC, Jena, Germany <REddyProc-help@bgc-jena.mpg.de> [cph], Thomas Wutzler <twutz@bgc-jena.mpg.de> [aut, cre], Markus Reichstein <mreichstein@bgc-jena.mpg.de> [aut], Antje Maria Moffat <antje.moffat@bgc.mpg.de> [aut, trl], Olaf Menzer <omenzer@bgc-jena.mpg.de> [ctb], Mirco Migliavacca <mmiglia@bgc-jena.mpg.de> [aut], Kerstin Sickel <ksickel@bgc-jena.mpg.de> [ctb, trl], Ladislav <U+0160>igut <sigut.l@czechglobe.cz> [ctb]

Examples

getTZone(as.POSIXct("2010-07-01 16:00:00", tz = "etc/GMT-1") )
#> [1] "etc/GMT-1"
getTZone(as.POSIXct("2010-07-01 16:00:00") )
#> [1] "GMT"
# printed with local time zone, but actually has no tz attribute
getTZone(Sys.time())
#> [1] "GMT"