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!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...