3

I've been learning how to use strptime() and time-zones date/times in genreal and I was interested to see how R handles the clocks changing from BST to GMT. I looked up a future date and read here that in 2019 the clocks go backwards from BST to GMT at 2am on 27 October.

So when I tried the code below (the day before the 27th) it shows BST - which I understand

> strptime("26/10/2019 00:00", format="%d/%m/%Y %H:%M", tz="Europe/London")
[1] "2019-10-26 BST"

Then I tried the day after the 27th and got GMT which makes sense

> strptime("28/10/2019 00:00", format="%d/%m/%Y %H:%M", tz="Europe/London")
[1] "2019-10-28 GMT"

So I wondered how it works with the time component and found that at 01:16 on the 27th October it is BST

> strptime("27/10/2019 01:16", format="%d/%m/%Y %H:%M", tz="Europe/London")
[1] "2019-10-27 01:16:00 BST"

And at 01:17 on the 27th October it changes to GMT

> strptime("27/10/2019 01:17", format="%d/%m/%Y %H:%M", tz="Europe/London")
[1] "2019-10-27 01:17:00 GMT"

I cant seem to find any explanation for this and would love some help with my understanding!

Holmestorm
  • 93
  • 7
  • I get the same result as you using `strptime`. But get the right result using lubridate. `lubridate::dmy_hm("27/10/2019 0:59", tz="Europe/London") #[1] "2019-10-27 00:59:00 BST" lubridate::dmy_hm("27/10/2019 01:00", tz="Europe/London") #[1] "2019-10-27 01:00:00 GMT"` – Tony Ladson Dec 02 '19 at 13:20

0 Answers0