# DateTime Formatting

**URL:** <https://discuss.rapid7.com/t/datetime-formatting/31000>\
**Category:** InsightConnect\
**Tags:** InsightConnect, workflow-building\
**Created:** [December 14, 2023, 3:29pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000 "2023-12-14T15:29:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [December 14, 2023, 3:29pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/1 "2023-12-14T15:29:56Z")

</div>

I pull a UCT Timestamp from an alert, does anyone have a good way to convert this to human readable without using a custom Python Script?  
e.g.  
“2023-12-07T17:48:50Z” to “12/17/2023 5:48:50 PM”

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [December 14, 2023, 5:41pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/2 "2023-12-14T17:41:39Z")

</div>

I do not have a current solution outside of scripting. The Get Date Time action in the Date/Time plugin supports modifying the output to meet your needs, but does not accept input. I put in a feature enhancement request for the plugin to allow actions such as “convert to local time” to be customizable. If it is picked up I will update this thread Brandon.

---

<div class="post-metadata">

**Author:** ![tristan\_harward](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/tristan_harward/32/142_2.png) [@tristan\_harward](https://discuss.rapid7.com/u/tristan_harward)\
**Post date:** [December 14, 2023, 9:08pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/3 "2023-12-14T21:08:19Z")

</div>

I’ve just run into this as well, trying to grab the last 1d of Closed investigations on a Timer trigger from InsightIDR.

Formatting the date to the format that InsightIDR expects it appears not to be possible with the Datetime plugin. It’s outputting 2023-12-07T17:48:50Z, which InsightIDR plugin doesn’t accept, and the Datetime plugin doesn’t have a formatter that takes arbitrary input.

@Darrick_Hall if we update the plugin I’d recommend looking at consistency (or at least a way to make consistent) with the date format of the Timer trigger, and the input of the InsightIDR actions.

---

<div class="post-metadata">

**Author:** ![Eric-Wilson](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/eric-wilson/32/2531_2.png) [@Eric-Wilson](https://discuss.rapid7.com/u/Eric-Wilson)\
**Post date:** [December 14, 2023, 10:24pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/4 "2023-12-14T22:24:11Z")

</div>

You can use pattern match to pull specific parts of the date/time and reorganize it with their respective variables latter on, but you wouldn’t be able to convert from 24h to 12h format without scripting.

Example:

- Pull Time and date as separate variables in pattern match: _Alert creation time: {{creation\_date:/\S_/}} {{creation\_time:/[^.]\*/}}.\*\*
- Reorganize in artifact: _{{[“Pattern Match - 1”].[creation\_date]}}T{{[“Pattern Match - 1”].[creation\_time]}}+00:00_

---

<div class="post-metadata">

**Author:** ![brandon\_mcclure](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/brandon_mcclure/32/182_2.png) [@brandon\_mcclure](https://discuss.rapid7.com/u/brandon_mcclure)\
**Post date:** [December 20, 2023, 3:32pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/5 "2023-12-20T15:32:42Z")

</div>

If I’m going to do Regex, than I might as well use a PowerShell step.  
It would be nice if the Datetime → Get Datetime had the option to put a string or leave blank for current time, and provided this output.

```auto
Get-Date 2023-12-07T18:48:50Z | Select-Object *

DisplayHint : DateTime
DateTime : Thursday, December 7, 2023 1:48:50PM
Date : 12/7/2023 12:00:00AM
Day : 7
DayOfWeek : Thursday
DayOfYear : 341
Hour : 13
Kind : Local
Millisecond : 0
Microsecond : 0
Nanosecond : 0
Minute : 48
Month : 12
Second : 50
Ticks : 638375537300000000
TimeOfDay : 13:48:50
Year : 2023

```

OR

```auto
Get-Date 2023-12-07T18:48:50Z | Select-Object * | ConvertTo-Json
{
  "DisplayHint": 2,
  "DateTime": "Thursday, December 7, 2023 1:48:50PM",
  "Date": "2023-12-07T00:00:00-05:00",
  "Day": 7,
  "DayOfWeek": 4,
  "DayOfYear": 341,
  "Hour": 13,
  "Kind": 2,
  "Millisecond": 0,
  "Microsecond": 0,
  "Nanosecond": 0,
  "Minute": 48,
  "Month": 12,
  "Second": 50,
  "Ticks": 638375537300000000,
  "TimeOfDay": {
    "Ticks": 497300000000,
    "Days": 0,
    "Hours": 13,
    "Milliseconds": 0,
    "Microseconds": 0,
    "Nanoseconds": 0,
    "Minutes": 48,
    "Seconds": 50,
    "TotalDays": 0.5755787037037037,
    "TotalHours": 13.813888888888888,
    "TotalMilliseconds": 49730000.0,
    "TotalMicroseconds": 49730000000.0,
    "TotalNanoseconds": 49730000000000.0,
    "TotalMinutes": 828.8333333333334,
    "TotalSeconds": 49730.0
  },
  "Year": 2023
}

```

---

<div class="post-metadata">

**Author:** ![Darrick\_Hall](https://discuss.rapid7.com/user_avatar/discuss.rapid7.com/darrick_hall/32/2530_2.png) [@Darrick\_Hall](https://discuss.rapid7.com/u/Darrick_Hall)\
**Post date:** [March 25, 2025, 10:12pm UTC](https://discuss.rapid7.com/t/datetime-formatting/31000/6 "2025-03-25T22:12:44Z")

</div>

I know it is quite a late response Brandon, but I have a new solution here.

If you use the JQ plugin and passed it a variable an object that looks like this:

{  
“Date”: “2023-12-07T17:48:50Z”  
}

This JQ filter would work:

.Date |= (strptime(“%Y-%m-%dT%H:%M:%SZ”) | strftime(“%m/%d/%Y %I:%M:%S %p”))

 ![Screenshot 2025-03-25 at 4.12.30 PM](https://forum-uploads-hub-prod-1-us-east-1-rapid7-com.s3.dualstack.us-east-1.amazonaws.com/original/2X/a/a2cf304007a5ea6bac670402d7202dd13279cc7f.png)
