Splunk Search

How to convert DD/MM/YYY to MM/DD/YYY format?

griffinpair
Path Finder

I currently have dates from a log file coming in as 09/07/2018 (July 9, 2018) and they need to be formatted as 07/09/2018.

0 Karma
1 Solution

pradeepkumarg
Influencer

Convert it into a date type variable using strptime and then format it using stftime. Sample run anywhere search below.

|makeresults | eval DATE="09/07/2018" | eval DATE_NEW=strftime(strptime(DATE, "%d/%m/%Y"), "%m/%d/%Y")

View solution in original post

pradeepkumarg
Influencer

Convert it into a date type variable using strptime and then format it using stftime. Sample run anywhere search below.

|makeresults | eval DATE="09/07/2018" | eval DATE_NEW=strftime(strptime(DATE, "%d/%m/%Y"), "%m/%d/%Y")

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...