For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Open sourceSupportFAQsDocs Home
DocumentationAPI ReferenceRelease notes
DocumentationAPI ReferenceRelease notes
  • Platform Cloud
    • Overview
    • Cloud vs. on-prem
    • Architecture
  • Apps
      • Overview
      • Navigate
        • Configure and manage tasks
        • Null vs. undefined values
        • Parallel branches
          • Overview
          • addDuration
          • arrayIncludes
          • arrayIndexOf
          • arrayLastIndexOf
          • arrayToString
          • calculateTimeDiff
          • charAt
          • charCodeAt
          • childjob
          • codePointAt
          • concatArray
          • convertEpochToObject
          • convertTimeFormat
          • convertTimeToEpoch
          • convertTimezone
          • copyWithin
          • csvStringToJSON
          • delay
          • endsWith
          • ErrorHandling
          • excelToJson
          • extractField
          • FlattenJSONFormInput
          • forEach
          • getTime
          • indexOf
          • join
          • keys
          • lastIndexOf
          • length
          • length (string)
          • localeCompare
          • makeData
          • map
          • match
          • newVariable
          • numberToString
          • objectHasOwnProperty
          • objectToString
          • padStart
          • parseInt
          • parse
          • arrayPop
          • pushToArray
          • push
          • query
          • repeat
          • restCall
          • runCode
          • search
          • setObjectKey
          • slice (array)
          • split
          • startsWith
          • stringValueOf
          • stub
          • substring
          • toLocaleLowerCase
          • toLocaleString
          • toLocaleUpperCase
          • toLowerCase
          • toUpperCase
          • transformation
          • trim
          • trimEnd
          • trimStart
          • unshift
          • updateJobDescription
          • values
          • viewData
    • FlowAI
  • Resources
    • Itential Academy
    • Itential MCP
    • Accessibility conformance
    • Get support
    • FAQs
LogoLogo
Open sourceSupportFAQsDocs Home
On this page
  • Potential use case
  • Properties
  • Input variables
  • Output variables
  • Example 1
  • Example 2
AppsStudioTasksTask reference

calculateTimeDiff

Was this page helpful?
Previous

charAt

Next
Built with

The calculateTimeDiff task calculates the difference between two timestamps and returns the result as a duration.

Potential use case

Use this task to determine the remaining time (or elapsed time) between a recorded timestamp and today’s date.

Properties

Input variables

IncomingTypeDescriptionExample
firstTimeObjectRequired. The base time from which secondTime is subtracted. Must contain time (string representation of the time) and formatString (the moment.js format the time must adhere to).{ "formatString": "YYYY-MM-DDTHH:mm:ss.SSSSSSZZ", "time": "2023-06-21T15:02:07.254000-1100" }
secondTimeObjectRequired. The time subtracted from firstTime. Must contain the same time and formatString keys.{ "formatString": "YYYY-MM-DDTHH:mm:ss.SSSSSSZZ", "time": "2023-04-28T01:21:14.052000-1100" }

Output variables

OutgoingTypeDescription
timeDiffObjectThe difference between the two timestamps expressed as a duration in multiple units (milliseconds, seconds, minutes, hours, days, months, and years).

Example 1

In this example:

  • The firstTime property comes from the output of addDuration, another task in the workflow. The reference variable is newtime.
  • The secondTime property comes from the getTime task. The reference variable is time.
  • Because secondTime is less than firstTime, the outgoing timeDiff is a positive reference — for example, the number of days until a future date.
calculateTimeDiff task with firstTime from addDuration and secondTime from getTime

Example 2

In this example:

  • The firstTime property comes from the getTime task. The reference variable is time.
  • The secondTime property comes from addDuration. The reference variable is newTime.
  • Because secondTime is greater than firstTime, the outgoing timeDiff is a negative reference — for example, the elapsed time since the firstTime deadline was passed.
calculateTimeDiff task with firstTime from getTime and secondTime from addDuration, producing a negative timeDiff