getTime

The getTime task obtains a current timestamp for use in other tasks in a workflow. An offset may be applied to the current timestamp if needed. The getTime task uses UTC for time representation.

Potential use case

Use this task to post the current time in a logfile or external database when an automation starts or completes. Using an offsetDuration, you can also use this task to provide a future timestamp calculated from the current time.

Properties

Input variables

IncomingTypeDescriptionExample
TimezoneEnumRequired. The timezone to use for getting the current time.EST UTC: −05:00 / EDT UTC: −04:00
offsetDurationObjectOptional. A duration to offset the current time, expressed as object literal notation. For example, {"days": 7, "months": 1} adds seven days and one month to the current timestamp. Numeric values without designators are treated as milliseconds.{"days": 7, "months": 1} / {"hours": 4} / 31556926000
formatStringOptional. The format in which the converted timestamp should be displayed. Accepts formats from the moment.js documentation. Leaving this blank defaults the outgoing time parameter to YYYY-MM-DDTHH:mm:ss.SSSSSSZZ.LLLL / MMM-DD-YYYY / hh:mm:ss

When using object literal notation in offsetDuration, you must include the curly braces. See the moment.js documentation for more information.

Output variables

OutgoingTypeDescription
timeObjectThe timestamp returned by the task, presented in the format specified by the incoming format parameter.

Example 1

In this example:

  • Timezone is UTC −04:00 (North American Eastern Time).
  • offsetDuration adds seven days and one month.
  • format is LLLL (month name, day of month, day of week, year, time).
  • The outgoing time value is presented in LLLL format.
getTime task with UTC -04:00, 7-day 1-month offset, and LLLL format

Example 2

In this example:

  • Timezone is UTC −04:00 (North American Eastern Time).
  • offsetDuration is 86400000 milliseconds (one day).
  • format is MMM-DD-YYYY (month-day-full year).
  • The outgoing time value is presented in MMM-DD-YYYY format.
getTime task with UTC -04:00, 86400000ms offset, and MMM-DD-YYYY format

Example 3

In this example:

  • Timezone is UTC −04:00 (North American Eastern Time).
  • offsetDuration adds four hours.
  • format is hh:mm:ss (hours:minutes:seconds).
  • The outgoing time value is presented in hh:mm:ss format.
getTime task with UTC -04:00, 4-hour offset, and hh:mm:ss format