Splunk Search

Splunk time format conversions?

pavanae
Builder

How do I convert the below time format 

2023-05-02T02:35:47Z into

2023-05-03 15:37:22

Labels (4)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the strptime function to convert the time into epoch form then use strftime to convert the epoch into the desired result.

| eval foo = strftime(strptime(foo, "%Y-%m-%dT%H:%M:%S%Z"), "%Y-%m-%d %H:%M:%S")

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use the strptime function to convert the time into epoch form then use strftime to convert the epoch into the desired result.

| eval foo = strftime(strptime(foo, "%Y-%m-%dT%H:%M:%S%Z"), "%Y-%m-%d %H:%M:%S")

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...