Skip to content

Commit 4dd1eb5

Browse files
committed
add duration intermediate type documentation
1 parent fad32ab commit 4dd1eb5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/documentation/language/datatypes.malloynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ Ranges may be used in conjunction with the [apply operator](apply.malloynb) to t
126126

127127
In the future, other ranges may be allowed, such as `string` ranges.
128128

129+
### Duration
130+
131+
Durations can be added to timestamps and dates.
132+
133+
* `@2001-02-03 04:05 + 5 minutes`
134+
* `@2001-02-03 04:05 + myHours hours`
135+
* `@2021-01-01 + 5 weeks`
136+
* `@0000-01-01 + myYear years + (daysIntoMyYear - 1) days`
137+
138+
A few notes:
139+
140+
1. Durations can be added or subtracted.
141+
142+
2. The legal units for durations are: microseconds, milliseconds,
143+
seconds, minutes, hours, days, weeks, years.
144+
145+
3. SQL durations, if the database has them, are not imported and cannot be used
146+
as Malloy durations.
147+
129148
### Alternations and Partials
130149

131150
_Partials_ represent a "part of" a comparison.

0 commit comments

Comments
 (0)