The duration field type is designed as a numerical field type for recording time durations in hours, minutes, seconds, or milliseconds. Depending on how the duration field is formatted, values are stored as either an integer or decimal, representing a specific number of seconds. For time durations measured in days, weeks, or larger units, it is advisable to utilize a standard number field for storage.
Duration fields capture time in Day, Hour, Minute, and Second increments. They're great for logging time, estimating tasks/work efforts, or specifying schedules (see gif below).
Entries are entered using natural language by typing things like 1d 2 hours 20 mins, 1h 30m, 1hr 30 mins, 8 hours, etc.
Adding a Duration field
Customizing/ Formatting the field
There are 3 display options available for duration fields:
Solution Managers can select Short, Standard (default), and Long display formats, along with Days, Hours, Minutes, and Seconds to configure the Duration format. Duration fields can be marked as required.
π Check out quick articles on Setting Default Field Values and Adding Help Text to fields.
Durations and Date Formulas
You have the ability to employ basic arithmetic operators (e.g., + for addition, - for subtraction, and so on) with durations. To compare durations, you can utilize a formula such as [End Time] - [Start time]. This will always give the result in seconds, so dividing by 60 will give the result in minutes, 3600 for the result in hours, etc.
Furthermore, you can integrate durations into particular date/time formulas.
In case you aim to adjust a time earlier or later using a formula, you can include a duration field in a DATEADD() formula. When doing this, always specify 'seconds' as the unit in the DATEADD() function, for instance: DATEADD( [Date field], [Duration field], 'seconds').
DATEADD
DATEADD(Date, Count, Unit)
Adds a specified number of hours, days, weeks, months or years to a date value. Unit is one of the following:
seconds
minutes
hours
days
weeks
months
years
Example:
DATEADD([Due],[Duration],"seconds") -> if [Due] is 1/1/2021, and [Duration] is 1d 2h, returns 1/2/2021 02:00 as date
To format the result of your date and time using the following function:
DATETIME_FORMAT
DATETIME_FORMAT(Date, Format)
Format the date and time. Supported formats include:
compact ( 1/2/2021 at 2:00AM )
standard ( Jan 2, 2021 at 2:00AM)
long ( Sat, Jan 2, 2021 at 2:00AM)
Example:
DATETIME_FORMAT([Date],"compact") ---> 1/2/2021 at 2:00PM as a date
Note: You can also check out our Formula Formatting, Functions, and Operators shared view for the full list of all functions, their descriptions, and examples on how they can be used.
Related Video Content