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, 2018 (variable A) and May 14, 2018 (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.
Navigation
- From any of the main Resolver screens, click the Administration icon.
Administration Icon
- From the Administration Overview screen, select the Object Types tile from the Data Model section.
Administration Overview
- From the Object Types screen, search for an existing Object Type.
- Click on an Object Type name to open the Edit Object Type screen.
Click on an Object Type Name
- Scroll to the bottom of the screen and select the Formulas tab.
Formulas Tab
- Click on a Formula name.
Formula Name Link
Converting Unix Timestamp Format to Standard Date Format
You can convert and display the timeOffset value from Unix Timestamp format to standard date format.
- From the Edit Formula screen, scroll to the Display section and select Label from the Range as drop-down list.
Select Label from the Range As Field
- Click on the Edit icon next to the first entry.
Click on the Edit Icon
- Delete the code from the Color drop-down field.
- Enter the date using the Standard Date format in the Label field.
- Enter the date using Unix Timestamp format in the Max Value field. A Unix Timestamp records the date in seconds.
Filled Out Display Fields
- Click on the Checkmark icon to save the formula's display settings.
Checkmark Icon