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 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...