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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...