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!

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...