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     
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to