getTime (time)
  • 27 Jul 2023
  • Dark
    Light
  • PDF

getTime (time)

  • Dark
    Light
  • PDF

Article summary

getTime Task Purpose

The getTime task allows you to obtain 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 if you need to post the current time in a logfile or external database when an automation is started or completed. Using an offsetDuration, you can also use this task to provide a future timestamp that can be calculated from the current timestamp.

Properties

Input and output properties are shown below.

Input Variables

Incoming Type Description Example
Timezone Enum Required. The Timezone to use for getting the current time. EST UTC: −05:00
EDT UTC: −04:00
offsetDuration Object Optional. A duration to offset the current time expressed as an object literal notation. For example: {"days": 7,"months":1} will add 7 days and 1 month to the current system timestamp. Numeric values entered without any other designators will be treated as milliseconds (default). {"days": 7,"months":1}
{"hours": 4}
31556926000
format String Optional. Represents the format in which the converted timestamp should be displayed. Accepts formats identified in the moment.js documentation. Leaving this parameter blank will default the outgoing time parameter to the format of YYYY-MM-DDTHH:mm:ss.SSSSSSZZ. { "time": "2023-04-28T01:21:14.052000-1100", "formatString": "YYYY-MM-DDTHH:mm:ss.SSSSSSZZ" }
Note:

If using object literal notations in the offsetDuration property, you must include the curly braces in the value. See examples below. For more information regarding the object literal notation, see the moment.js documentation.


Output Variables

Outgoing Type Description
time Object The new timestamp that is returned by the task. Presented in the format specified by the incoming format parameter.

Example 1

In this IAP example:

  • The Timezone variable is set to UTC -04:00 (North American Eastern Time).

  • The offsetDuration will add 7 days and 1 month to the Timezone value that is retrieved.

  • The format variable is set to LLLL, which is the format for Month name, day of month, day of week, year, time.

  • For this example, the new time value produced upon output will be presented in the LLLL format specified by the incoming format variable.

    getTime-01

Example 2

In this IAP example:

  • The Timezone property is is set to UTC -04:00 (North American Eastern Time).

  • The offsetDuration will add 86400000 milliseconds (1 day) to the Timezone value that is retrieved.

  • The format variable is set to MMM-DD-YYYY, which is the format for Month-Day-Full Year.

  • For this example, the new time value produced upon output will be presented in the MMM-DD-YYYY format specified by the incoming format variable.

    getTime-02

Example 3

In this IAP example:

  • The Timezone variable is set to UTC -04:00 (North American Eastern Time).

  • The offsetDuration will add 4 hours to the Timezone value that is retrieved.

  • The format variable is set to hh:mm:ss, which is the format for Hours:Minutes:Seconds.

  • For this example, the new time value produced upon output will be presented in the hh:mm:ss format specified by the incoming format variable.

    getTime-03


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.