Skip to content

Instantly share code, notes, and snippets.

@jido
Last active April 16, 2022 20:18
Show Gist options
  • Save jido/1355e1bd720224364fa06937779f201d to your computer and use it in GitHub Desktop.
Save jido/1355e1bd720224364fa06937779f201d to your computer and use it in GitHub Desktop.
EST becomes EDT
> library(clock)
> x <- as.POSIXct("2020-11-01 00:30:00", "America/New_York")
> x <- add_hours(x, 0:2)
> x
[1] "2020-11-01 00:30:00 EDT" "2020-11-01 01:30:00 EDT"
[3] "2020-11-01 01:30:00 EST"
> add_years(x, 1)
[1] "2021-11-01 00:30:00 EDT" "2021-11-01 01:30:00 EDT"
[3] "2021-11-01 01:30:00 EDT"
> add_years(x, -1)
[1] "2019-11-01 00:30:00 EDT" "2019-11-01 01:30:00 EDT"
[3] "2019-11-01 01:30:00 EDT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment