- 27 Jul 2023
-
DarkLight
-
PDF
getTime (time)
- Updated on 27 Jul 2023
-
DarkLight
-
PDF
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" } |
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 theTimezone
value that is retrieved. -
The
format
variable is set toLLLL
, 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 theLLLL
format specified by the incomingformat
variable.
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 theTimezone
value that is retrieved. -
The
format
variable is set toMMM-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 theMMM-DD-YYYY
format specified by the incomingformat
variable.
Example 3
In this IAP example:
-
The
Timezone
variable is set to UTC-04:00
(North American Eastern Time). -
The
offsetDuration
will add4 hours
to theTimezone
value that is retrieved. -
The
format
variable is set tohh:mm:ss
, which is the format for Hours:Minutes:Seconds. -
For this example, the new
time
value produced upon output will be presented in thehh:mm:ss
format specified by the incomingformat
variable.