Created
May 2, 2017 17:50
-
-
Save Dmitrii-I/fe5f3d2c473f949cd3c95f63c30d06e7 to your computer and use it in GitHub Desktop.
Weird timezone behavior POSIXct objects in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat('Weird timezone behavior') | |
# Weird timezone behavior | |
(t1 <- as.POSIXct(c('2015-02-01 20:00', '2015-10-25 02:57'))) # CET CET | |
# [1] "2015-02-01 20:00:00 CET" "2015-10-25 02:57:00 CET" | |
(t2 <- as.POSIXct(c('2015-06-01 20:00', '2015-10-25 02:57'))) # CEST CEST | |
# [1] "2015-06-01 20:00:00 CEST" "2015-10-25 02:57:00 CEST" | |
(t3 <- as.POSIXct('2015-10-25 02:57')) # CEST | |
# [1] "2015-10-25 02:57:00 CEST" | |
t1[2] == t2[2] | |
# [1] FALSE | |
(t2 <- as.POSIXct(c('2015-06-01 20:00', '2015-10-25 02:57'))) # CEST CEST | |
# [1] "2015-06-01 20:00:00 CEST" "2015-10-25 02:57:00 CEST" | |
(t1 <- as.POSIXct(c('2015-02-01 20:00', '2015-10-25 02:57'))) # CET CET | |
# [1] "2015-02-01 20:00:00 CET" "2015-10-25 02:57:00 CET" | |
(t3 <- as.POSIXct('2015-10-25 02:57')) # CET | |
# [1] "2015-10-25 02:57:00 CET" | |
t1[2] == t2[2] | |
# [1] FALSE | |
t1[2] == t3 | |
# [1] TRUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment