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!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...