Overview
The timeDiff and timeOffset functions use date-related data to perform a calculation or task. These functions do not require multiple values and do not require relationships, reference variable types, or data from more than one field or formula.
Warning:
Formulas do not calculate automatically on their own. A formula will re-calculate whenever a variable referenced by the formula changes in value.
timeDiff
The timeDiff function returns differences between two dates using Date & Time variables or a Date & Time variable and the today function in seconds, days, or hours.
Example: Using the dates May 15, 2024 (variable A) and May 14, 2024 (variable B), this function could return the following:
Unit of Time |
Formula |
Results |
---|---|---|
Seconds (default) | timeDiff(A,B) | 86400 |
Hours | timeDiff(A,B,"hours") | 24 |
Days* | timeDiff(A,B,"days") | 1 |
Today's Date | timeDiff(today(),B,"days") | 1 |
* The Days formula can only be used as a workflow condition, not with forms, as the formula does not auto-update. |
timeOffset
The timeOffset function offsets (adds or subtracts) seconds, days, or months from a Date & Time field variable. The function returns results in Unix (epoch) timestamp format (e.g., May 2018 = 1525132800). For further information, see the Converting Unix Timestamp Format to Standard Date Format section or Contact Resolver Support for additional information.
Example: Using May 15, 2018 (variable A) as an example, this function could return the following:
Unit of Time |
Formula |
Results |
---|---|---|
Seconds | timeOffset(A,86400,"seconds") | 1526495700 (May 16, 2018) |
Days* | timeOffset(A,2,"days") | 1526582100 (May 17, 2018) |
Months | timeOffset(A,1,"months") | 1529087700 (June 15, 2018) |
Days* (Subtracted) | timeOffset(A,-3,"days") | 1526150100 (May 12, 2018) |
* The Days formula can only be used as a workflow condition, not with forms, as the formula does not auto-update. |
Formulas can display dates using date formats. Existing formulas will need to be updated to date to display dates using date formats instead of Unix code.