From e6eb0d65d8684b42b6f4824a9b0446f3f9557650 Mon Sep 17 00:00:00 2001 From: hadley Date: Mon, 15 Aug 2016 09:53:14 -0500 Subject: [PATCH] Mention numeric offsets from epoch --- datetimes.Rmd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datetimes.Rmd b/datetimes.Rmd index be710d8..e393139 100644 --- a/datetimes.Rmd +++ b/datetimes.Rmd @@ -160,6 +160,13 @@ You may want to switch between a date-time and a date. That's the job of `as_dat as_date(now()) ``` +Sometimes you'll get date/times as numeric offsets from the "Unix Epoch", 1970-01-01. If the offset is in seconds, use `as_datetime()`; if it's in days, use `as_date()`. + +```{r} +# as_datetime(60 * 60 * 10) +as_date(365) +``` + ### Exercises 1. What happens if you parse a string that contains invalid dates?