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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...