Skip to main content

GetTime

This Script is part of the Common Scripts Pack.#

Retrieves the current date and time.

Script Data#


NameDescription
Script Typejavascript
TagsUtility
Cortex XSOAR Version5.0.0

Inputs#


Argument NameDescription
dateThe date to use in the object.
dateFormatThe date format for the result. Can be ISO/GMT/UTC/Locale/Date/Year/Month/Day/DayInWeek/Hours.
Note that the response will start from 0. For example, if the current month is October
(the 10th month) the result will be 9.
Note:
In Cortex XSOAR versions 6.11 or later, or 8.1.0 or later, the time format returned when UTC or GMT is given has changed.
Instead of 'Wed Jan 18 2023 12:59:12 GMT+0000 (UTC)', The output will be 'Wed, 18 Jan 2023 15:59:12 GMT'.
contextKeyPrefix the keys in the context for the results.
minutesAgoWill subtract minutesAgo minutes from current time.
hoursAgoWill subtract hoursAgo hours from current time.
daysAgoWill subtract daysAgo days from current time.
monthsAgoWill subtract monthsAgo months from current time.
yearsAgoWill subtract yearsAgo years from current time.

Outputs#


PathDescriptionType
TimeNowUnixNumber of milliseconds since 1970/01/01.Number
TimeNowCurrent time.String