diff --git a/content/v2.0/reference/flux/stdlib/date/hour.md b/content/v2.0/reference/flux/stdlib/date/hour.md index 02bde42e7..1475e1a1d 100644 --- a/content/v2.0/reference/flux/stdlib/date/hour.md +++ b/content/v2.0/reference/flux/stdlib/date/hour.md @@ -29,10 +29,11 @@ date.hour(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.hour(t: -8h) // Returns 4 ``` + +##### Return the hour of a nanosecond Unix timestamp +```js +import "date" + +date.hour(t: 1581423663293534940) + +// Returns 12 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/microsecond.md b/content/v2.0/reference/flux/stdlib/date/microsecond.md index 3b6def9d0..acadd5084 100644 --- a/content/v2.0/reference/flux/stdlib/date/microsecond.md +++ b/content/v2.0/reference/flux/stdlib/date/microsecond.md @@ -29,10 +29,11 @@ date.microsecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.microsecond(t: -1890us) // Returns 291644 ``` + +##### Return the microsecond of a nanosecond Unix timestamp +```js +import "date" + +date.microsecond(t: 1581423663293534940) + +// Returns 293534 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/millisecond.md b/content/v2.0/reference/flux/stdlib/date/millisecond.md index 31496d092..0febcb59b 100644 --- a/content/v2.0/reference/flux/stdlib/date/millisecond.md +++ b/content/v2.0/reference/flux/stdlib/date/millisecond.md @@ -29,10 +29,11 @@ date.millisecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.millisecond(t: -150ms) // Returns 143 ``` + +##### Return the millisecond of a nanosecond Unix timestamp +```js +import "date" + +date.millisecond(t: 1581423663293534940) + +// Returns 293 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/minute.md b/content/v2.0/reference/flux/stdlib/date/minute.md index d1e9db92c..2706460e6 100644 --- a/content/v2.0/reference/flux/stdlib/date/minute.md +++ b/content/v2.0/reference/flux/stdlib/date/minute.md @@ -29,10 +29,11 @@ date.minute(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.minute(t: -45m) // Returns 36 ``` + +##### Return the minute of a nanosecond Unix timestamp +```js +import "date" + +date.minute(t: 1581423663293534940) + +// Returns 21 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/month.md b/content/v2.0/reference/flux/stdlib/date/month.md index 01330e261..eaa2208fc 100644 --- a/content/v2.0/reference/flux/stdlib/date/month.md +++ b/content/v2.0/reference/flux/stdlib/date/month.md @@ -29,10 +29,11 @@ date.month(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.month(t: -3mo) // Returns 11 ``` + +##### Return the month of a nanosecond Unix timestamp +```js +import "date" + +date.month(t: 1581423663293534940) + +// Returns 2 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/monthday.md b/content/v2.0/reference/flux/stdlib/date/monthday.md index 36684343f..b1ac40d64 100644 --- a/content/v2.0/reference/flux/stdlib/date/monthday.md +++ b/content/v2.0/reference/flux/stdlib/date/monthday.md @@ -29,10 +29,11 @@ date.monthDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.monthDay(t: -8d) // Returns 3 ``` + +##### Return the day of the month for a nanosecond Unix timestamp +```js +import "date" + +date.monthDay(t: 1581423663293534940) + +// Returns 11 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/nanosecond.md b/content/v2.0/reference/flux/stdlib/date/nanosecond.md index 846aa0129..610ced7aa 100644 --- a/content/v2.0/reference/flux/stdlib/date/nanosecond.md +++ b/content/v2.0/reference/flux/stdlib/date/nanosecond.md @@ -29,10 +29,11 @@ date.nanosecond(t: 2019-07-17T12:05:21.012934584Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.nanosecond(t: -2111984ns) // Returns 291422956 ``` + +##### Return the nanosecond for a nanosecond Unix timestamp +```js +import "date" + +date.nanosecond(t: 1581423663293534940) + +// Returns 293534940Z +``` diff --git a/content/v2.0/reference/flux/stdlib/date/quarter.md b/content/v2.0/reference/flux/stdlib/date/quarter.md index 5a225a4a9..56edb7ed7 100644 --- a/content/v2.0/reference/flux/stdlib/date/quarter.md +++ b/content/v2.0/reference/flux/stdlib/date/quarter.md @@ -29,10 +29,11 @@ date.quarter(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.quarter(t: -7mo) // Returns 3 ``` + +##### Return the quarter for a nanosecond Unix timestamp +```js +import "date" + +date.quarter(t: 1581423663293534940) + +// Returns 1 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/second.md b/content/v2.0/reference/flux/stdlib/date/second.md index 33493d457..302700305 100644 --- a/content/v2.0/reference/flux/stdlib/date/second.md +++ b/content/v2.0/reference/flux/stdlib/date/second.md @@ -29,10 +29,11 @@ date.second(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.second(t: -50s) // Returns 13 ``` + +##### Return the second of a nanosecond Unix timestamp +```js +import "date" + +date.second(t: 1581423663293534940) + +// Returns 3 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/truncate.md b/content/v2.0/reference/flux/stdlib/date/truncate.md index f2ef1cb3b..5f13e548b 100644 --- a/content/v2.0/reference/flux/stdlib/date/truncate.md +++ b/content/v2.0/reference/flux/stdlib/date/truncate.md @@ -30,10 +30,11 @@ date.truncate( ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ### unit The unit of time to truncate to. @@ -76,3 +77,17 @@ date.truncate(t: -1m, unit: 1m) date.truncate(t: -1h, unit: 1h) // Returns 2019-12-31T23:00:00.000000000Z ``` + +##### Truncate time values using nanosecond Unix timestamps +```js +import "date" + +date.truncate(t: 1559570341000000000, unit: 1s) +// Returns 2019-06-03T13:59:01.000000000Z + +date.truncate(t: 1559570341000000000, unit: 1m) +// Returns 2019-06-03T13:59:00.000000000Z + +date.truncate(t: 1559570341000000000, unit: 1h) +// Returns 2019-06-03T13:00:00.000000000Z +``` diff --git a/content/v2.0/reference/flux/stdlib/date/week.md b/content/v2.0/reference/flux/stdlib/date/week.md index d508e7c10..0eefcef9a 100644 --- a/content/v2.0/reference/flux/stdlib/date/week.md +++ b/content/v2.0/reference/flux/stdlib/date/week.md @@ -29,10 +29,11 @@ date.week(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.week(t: -12d) // Returns 5 ``` + +##### Return the week of the year using a nanosecond Unix timestamp +```js +import "date" + +date.week(t: 1581423663293534940) + +// Returns 7 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/weekday.md b/content/v2.0/reference/flux/stdlib/date/weekday.md index 0afcf7c67..437b01009 100644 --- a/content/v2.0/reference/flux/stdlib/date/weekday.md +++ b/content/v2.0/reference/flux/stdlib/date/weekday.md @@ -29,10 +29,11 @@ date.weekDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.weekDay(t: -84h) // Returns 6 ``` + +##### Return the day of the week for a nanosecond Unix timestamp +```js +import "date" + +date.weekDay(t: 1581423663293534940) + +// Returns 2 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/year.md b/content/v2.0/reference/flux/stdlib/date/year.md index fd452ed2f..3726c1cb8 100644 --- a/content/v2.0/reference/flux/stdlib/date/year.md +++ b/content/v2.0/reference/flux/stdlib/date/year.md @@ -27,10 +27,11 @@ date.year(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -53,3 +54,12 @@ date.year(t: -14y) // Returns 2006 ``` + +##### Return the year for a nanosecond Unix timestamp +```js +import "date" + +date.year(t: 1581423663293534940) + +// Returns 2020 +``` diff --git a/content/v2.0/reference/flux/stdlib/date/yearday.md b/content/v2.0/reference/flux/stdlib/date/yearday.md index a7ff048fb..8e46b81cb 100644 --- a/content/v2.0/reference/flux/stdlib/date/yearday.md +++ b/content/v2.0/reference/flux/stdlib/date/yearday.md @@ -29,10 +29,11 @@ date.yearDay(t: 2019-07-17T12:05:21.012Z) ### t The time to operate on. -Use an absolute time or relative duration. +Use an absolute time, relative duration, or integer. Durations are relative to `now()`. +Integers are **nanosecond** [Unix timestamps](/v2.0/reference/glossary/#unix-timestamp). -_**Data type:** Time | Duration_ +_**Data type:** Time | Duration | Integer_ ## Examples @@ -55,3 +56,12 @@ date.yearDay(t: -1mo) // Returns 11 ``` + +##### Return the day of the year for a nanosecond Unix timestamp +```js +import "date" + +date.yearDay(t: 1581423663293534940) + +// Returns 42 +```