[R] strange convention for time zone names

Denis Chabot chabot.denis at gmail.com
Fri Aug 19 16:16:21 CEST 2011


Hi,

My time zone in Montreal is "Standard time zone:	UTC/GMT -5 hours"  (see <http://www.timeanddate.com/worldclock/city.html?n=165>).

Yet, in R (POSIXct objects) I must specify the opposite, i.e. "UTC+5":

dateMontreal = as.POSIXct("2011-01-15 05:00:00", tz="EST")
dateMontreal2 = as.POSIXct("2011-01-15 05:00:00", tz="UTC+5")
wrongdateMontreal = as.POSIXct("2011-01-15 05:00:00", tz="UTC-5")

dateLondon = as.POSIXct("2011-01-15 10:00:00", tz="UTC0")
difftime(dateMontreal, dateLondon)
Time difference of 0 secs

difftime(dateMontreal2, dateLondon)
Time difference of 0 secs

difftime(wrongdateMontreal, dateLondon)
Time difference of -10 hours

Is there a reason for this counter-intuitive convention?

Denis
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] fr_CA.UTF-8/fr_CA.UTF-8/C/C/fr_CA.UTF-8/fr_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     


More information about the R-help mailing list