Splunk Search

Change time format

TheBravoSierra
Path Finder

I have a field called "Completed_On" in time format: 12/23/2020 14:16:51.

I'd like to remove the hours, minutes, and seconds so it just displays 12/23/2020. 

How can I do this? 

Labels (2)
0 Karma
1 Solution

alonsocaio
Contributor

HI @TheBravoSierra 

You can try using the strftime function:

| eval Completed_On_New = strftime(Completed_On, "%m/%d/%Y")

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @TheBravoSierra,

Try below;

| eval Completed_On=mvindex(split(Completed_On," "),0)

 

If this reply helps you an upvote is appreciated.

If this reply helps you an upvote and "Accept as Solution" is appreciated.

alonsocaio
Contributor

HI @TheBravoSierra 

You can try using the strftime function:

| eval Completed_On_New = strftime(Completed_On, "%m/%d/%Y")
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...