#duration
Builds a length of time out of four numbers: days, hours, minutes, seconds.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
#duration(days as number, hours as number, minutes as number, seconds as number) as duration
| Parameter | Type | Description |
|---|---|---|
days | number | Whole or part days. |
hours | number | Hours; more than 24 carry over into days. |
minutes | number | Minutes; more than 60 carry over into hours. |
seconds | number | Seconds, with a fraction if needed. |
Returns
duration. The total length of time, shown as days, hours, minutes and seconds.
Remarks
- Each part may be a fraction or negative: the four are added up into one length of time.
- Add a duration to a date, datetime, datetimezone or time to move it; subtract two datetimes to get one.
Examples
A delivery time
#duration(2, 5, 30, 0)
#duration(2, 5, 30, 0)
Hours carry over into days
#duration(0, 36, 0, 0)
#duration(1, 12, 0, 0)
Promising a delivery 36 hours after the order
#datetime(2024, 3, 15, 8, 0, 0) + #duration(0, 36, 0, 0)
#datetime(2024, 3, 16, 20, 0, 0)
Related functions
Duration.From, Duration.FromText, Duration.TotalHours, #datetime.