I have to read in R an excel file with a datetime field expressed as UTC+01 (so an offset of 1h from UTC and no DST). I want to take into account the offset and join this dataframe with another one where datetime is expressed as locale (same 1h offset from UTC but with DST). I would like to have the resulting dataframe with datetimes in locale.
Asked
Active
Viewed 37 times
0
-
2It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Dec 16 '19 at 16:13
1 Answers
0
The lubridate package may be useful.
library(lubridate)
x <- ymd_hms("2009-08-07 02:00:01")
#[1] "2009-08-07 02:00:01 UTC"
hour(x) <- hour(x) + 1
x
#[1] "2009-08-07 03:00:01 UTC"

Tony Ladson
- 3,539
- 1
- 23
- 30