From 4dd1eb5b039c37f819b958b1cb84b1a2a0ab5f25 Mon Sep 17 00:00:00 2001 From: Rett Berg Date: Tue, 22 Aug 2023 13:08:22 -0500 Subject: [PATCH] add duration intermediate type documentation --- src/documentation/language/datatypes.malloynb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/documentation/language/datatypes.malloynb b/src/documentation/language/datatypes.malloynb index 39fb9cf2..51f03ae8 100644 --- a/src/documentation/language/datatypes.malloynb +++ b/src/documentation/language/datatypes.malloynb @@ -126,6 +126,25 @@ Ranges may be used in conjunction with the [apply operator](apply.malloynb) to t In the future, other ranges may be allowed, such as `string` ranges. +### Duration + +Durations can be added to timestamps and dates. + +* `@2001-02-03 04:05 + 5 minutes` +* `@2001-02-03 04:05 + myHours hours` +* `@2021-01-01 + 5 weeks` +* `@0000-01-01 + myYear years + (daysIntoMyYear - 1) days` + +A few notes: + +1. Durations can be added or subtracted. + +2. The legal units for durations are: microseconds, milliseconds, + seconds, minutes, hours, days, weeks, years. + +3. SQL durations, if the database has them, are not imported and cannot be used + as Malloy durations. + ### Alternations and Partials _Partials_ represent a "part of" a comparison.