daylight saving time

This commit is contained in:
mine-cetinkaya-rundel 2023-05-25 21:07:55 -04:00
parent f323ade5cf
commit 8def8051f6
1 changed files with 5 additions and 5 deletions

View File

@ -175,7 +175,7 @@ ymd("2017-01-31", tz = "UTC")
```
Here I use the UTC[^datetimes-3] timezone which you might also know as GMT, or Greenwich Mean Time, the time at 0° longitude[^datetimes-4]
. It doesn't use daylight savings time, making it a bit easier to compute with
. It doesn't use daylight saving time, making it a bit easier to compute with
.
[^datetimes-3]: You might wonder what UTC stands for.
@ -288,7 +288,7 @@ as_date(365 * 10 + 2)
2. What does the `tzone` argument to `today()` do?
Why is it important?
3. For each of the following date-times show how you'd parse it using a readr column-specification and a lubridate function.
3. For each of the following date-times, show how you'd parse it using a readr column specification and a lubridate function.
```{r}
d1 <- "January 1, 2010"
@ -411,7 +411,7 @@ ggplot(sched_dep, aes(x = minute, y = n)) +
### Rounding
An alternative approach to plotting individual components is to round the date to a nearby unit of time, with `floor_date()`, `round_date()`, and `ceiling_date()`.
Each function takes a vector of dates to adjust and then the name of the unit round down (floor), round up (ceiling), or round to.
Each function takes a vector of dates to adjust and then the name of the unit to round down (floor), round up (ceiling), or round to.
This, for example, allows us to plot the number of flights per week:
```{r}
@ -533,7 +533,7 @@ h_age <- today() - ymd("1979-10-14")
h_age
```
A difftime class object records a time span of seconds, minutes, hours, days, or weeks.
A `difftime` class object records a time span of seconds, minutes, hours, days, or weeks.
This ambiguity can make difftimes a little painful to work with, so lubridate provides an alternative which always uses seconds: the **duration**.
```{r}
@ -618,7 +618,7 @@ Compared to durations, periods are more likely to do what you expect:
ymd("2024-01-01") + dyears(1)
ymd("2024-01-01") + years(1)
# Daylight Savings Time
# Daylight saving time
one_am + ddays(1)
one_am + days(1)
```