Hello,

The reason why is that you've misspelled CET (not CEST)

> dt1 = as.POSIXct("2014-04-18 09.00", format="%Y-%m-%d %H.%M", tz = "CEST")
Warning messages:
1: In strptime(x, format, tz = tz) : unknown timezone 'CEST'
2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
  unknown timezone 'CEST'
> dt2 = as.POSIXct("2014-04-18 09.00", format="%Y-%m-%d %H.%M", tz = "GMT")
> dt1 = as.POSIXct("2014-04-18 09.00", format="%Y-%m-%d %H.%M", tz = "CET")
> dt1-dt2
Time difference of -2 hours


Hope this helps,

Rui Barradas

Em 18-04-2014 17:13, Nicola Sturaro Sommacal escreveu:
Hi.

I am new to POSIX and I'd like to understand the reason of this difference.

dt1 = as.POSIXct("2014-03-29 09.00", format="%Y-%m-%d %H.%M")
dt2 = as.POSIXct("2014-03-30 09.00", format="%Y-%m-%d %H.%M")
dt2-dt1

dt1[1] "2014-03-29 09:00:00 CET"> dt2[1] "2014-03-30 09:00:00 CEST"> dt2-dt1

Time difference of 23 hours

This is right, because on Mar 31 at 2 PM we jump directly to 3PM, DST.

On the contrary, I don't understand the following:

dt1 = as.POSIXct("2014-04-18 09.00", format="%Y-%m-%d %H.%M", tz = "CEST")
dt2 = as.POSIXct("2014-04-18 09.00", format="%Y-%m-%d %H.%M", tz = "GMT")

dt1[1] "2014-04-18 09:00:00 CEST"> dt2[1] "2014-04-18 09:00:00 GMT"> 
dt1-dt2Time difference of 0 secs


I should expected a time difference of 2 hours, as CEST is GMT+2.

Anyone can help me?

Thank you,
Nicola

        [[alternative HTML version deleted]]

______________________________________________
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.


______________________________________________
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