Getting Data In

How to change Date format from 12/21/2023 to 2023-21-12?

sambita_gt
Engager

Hi ,

I want to change the date format from
7/30/2023 12:00:00 AM to 2023-07-30

I am using following command but seems no luck

eval DesiredDate = strftime(strptime(DesiredDate,"%m/%d/%YT%H:%M:%S.%QZ"),"%m-%d-%Y")

Labels (5)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Your formats don't match your example - try this

eval DesiredDate = strftime(strptime(DesiredDate,"%m/%d/%Y %I:%M:%S %p"),"%Y-%d-%m")

Time formats are described here 

Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...