Splunk Search

What is the correct strptime argument?

superisk
Explorer

Hi all,

I am confident with strptime/strftime but i'm really struggling with the correct strptime argument for the following date/time format -

2023-01-25T21:32:04:501+0000

The T between date and time is causing me issues. Thank you in advance!

Labels (1)
0 Karma
1 Solution

rut
Path Finder

Are you getting an error? Adding a "T" in the format is allowed, the following works for me:

| makeresults
| eval example="2023-01-25T21:32:04:501+0000"
| eval parsed_dt=strptime(example, "%Y-%m-%dT%H:%M:%S:%Q%z")
| eval parsed_s=strftime(parsed_dt, "%Y-%m-%dT%H:%M:%S:%Q%z")

View solution in original post

rut
Path Finder

Are you getting an error? Adding a "T" in the format is allowed, the following works for me:

| makeresults
| eval example="2023-01-25T21:32:04:501+0000"
| eval parsed_dt=strptime(example, "%Y-%m-%dT%H:%M:%S:%Q%z")
| eval parsed_s=strftime(parsed_dt, "%Y-%m-%dT%H:%M:%S:%Q%z")

superisk
Explorer

Perfect thank you! It was the %Q i was missing. Much appreciated.

0 Karma
Get Updates on the Splunk Community!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...