Torq’s Date and Time utilities perform common date and time operations, such as calculating durations, converting formats, retrieving current dates, and comparing timestamps.
Supported date/time layouts
All Date and Time utilities in Torq use ISO 8601 by default (YYYY-MM-DDTHH:MM:SSZ) to keep timestamps consistent across integrations and systems. They also support Go (Golang) time layouts, as shown below.
Layout | Meaning |
| ISO-8601 / RFC3339 with timezone |
| Full Go style with weekday + timezone |
| Same as above, without timezone |
| Day-month-yy + time + timezone name |
| Day-month-yy + time + numeric timezone offset |
| Full weekday name + timezone |
| RFC1123-like header/email date |
| 12-hour time with AM/PM |
| 24-hour time with seconds |
| Compact numeric date |
| Date only |
| Date + 24-hour time |
| Year-day-month + time |
| Unix epoch seconds value (not a layout). Use a layout above to format it. |
| Customized date/time format. Replace the parts you want to display and keep any separators exactly as you want them to appear. |
Get Date
Returns the current date in the defined format. You can optionally set an offset (to move forward or backward in time) and specify a time zone.
Input
{
"Date_Format": "%Y-%m-%dT%H:%M:%S",
"Offset": "-24h",
"Time_Zone": "America/New_York"
}Output
2022-06-14T14:30:45
If working across multiple regions:
Always specify the
Time_Zoneparameter explicitly to avoid UTC/local discrepancies.Use clear UTC offsets when parsing or converting dates (e.g.,
+00:00,05:00).
Convert Date
Converts a date from one format to another.
Input
{
"Date": "2006-01-02T15:04:05Z",
"Current_Date_Format_Layout": "2006-01-02T15:04:05Z07:00",
"New_Date_Format_Layout": "Mon Jan 2 15:04:05 MST 2006"
}Output
Mon Jan 2 15:04:05 MST 2006
When using Convert Date, ensure the Current Date Format Layout exactly matches the format of your input date string. A mismatch will cause the conversion to fail or produce invalid results.
Calculate End Date
Calculates the end date by adding a specified duration to a given start date.
Input
{
"Start_Date": "2023-01-01T00:00:00Z",
"Duration": "48h"
}Output
2023-01-03T00:00:00Z
Calculate Calendar Days
Calculates the number of calendar days between two dates.
Input
{
"Start_Date": "2023-01-01T00:00:00Z",
"End_Date": "2023-01-10T00:00:00Z"
}Output
9
Calculate Time Duration
Calculates the time elapsed from a given date to the current time and returns the result in the specified format.
Input
{
"Date_Format": "%Y-%m-%dT%H:%M:%S",
"Date": "2006-08-29T23:59:11"
}Output
138422h29m13.895503549s
Check DST Status
Verifies whether Daylight Saving Time (DST) is currently in effect for a given region at the time of execution. Supported regions: EU, USA, IST, and AUS. If DST is in effect, the step returns true.
Input
{
"Region": "USA"
}Output
true
Use case: Convert Date
Automatically tag newly created cases as Weekday or Weekend using the Date and Time utility. This workflow helps teams quickly identify cases created outside of business hours.
For a detailed implementation, refer to the full workflow template available in Torq.
Define workflow parameters: Set up the timezone (
Europe/London)Find the hour and the day of the week for a case’s creation time:
Use the Parallel Executions step to run simultaneously two Convert Date utility instances to:
Find hour in local TZ by extracting the hour (00–23) from the case creation timestamp. It converts the case’s creation date (
{{ $.event.cases.current.created_at }}) into just the hour portion, adjusted for the defined timezone.Find day in local TZ by extracting the day of the week (0 to 6) from the same creation timestamp. The
%wreturns a number where:0= Sunday1= Monday…6= Saturday
Continue with the next steps: After extracting the local hour and day using Convert Date in parallel, the workflow evaluates whether the case was created during working hours or on a weekend. It then applies the appropriate tag (e.g., Weekday or Weekend) and can trigger follow-up actions such as notifying the relevant team or updating the case in Torq.
Use case: Get Date
AppSec or SOC teams often need a fast way to answer: “Do we have any packages, projects, or cloud assets affected by this CVE?” This workflow lets analysts run a CVE lookup from Slack, automatically search the connected security platforms across all relevant organizations for matching findings, and open or update a Jira issue with the latest exposure details.
The Get Date utility defines the search window used by those platform queries, ensuring results reflect recent exposure and making the evidence consistent and reproducible in Slack and Jira.
For a detailed implementation, refer to the full workflow template available in Torq.
Trigger CVE search from Slack:
Configure a Slack trigger to run on messages that include
cve-search.Extract the first CVE ID from the message text.
If no CVE is found, reply in-thread with usage instructions and stop the workflow.
Get time window using Get Date utility: Use the Parallel Executions step to run two Get Date utility instances:
Get date now: Add a Get Date utility step to capture the current timestamp. Store the output for later use as the end time for your security platform searches.
Get date 1 month ago: Add a second Get Date utility step with
TIME_AGO: 30dto capture the timestamp from 30 days prior. Store the output for later use as the start time for your security platform searches.Store both outputs and use them as the search window for your security platform queries.
Continue with the next steps: After defining the time window with Get Date, the workflow lists all available organizations across the connected security platforms, loops through each one, and searches for findings matching the extracted CVE within the last 30 days. It then normalizes and aggregates the results, posts a CSV summary back to the originating Slack thread (or a “no exposure found” notice if empty), and creates or updates a Jira issue for that CVE.




