Splunk Search

timeformat

shangshin
Builder

Hi,
Ny log has a timeformat like this -- 4/22/14 12:59:56.000 AM. How can I make the display like 4/22/14 00:59:56.000 AM

I tried to covert the time by using | eval desired_time=strftime(_time, "%H:%M:%S %p") |

However, date_hour is still showing the value of 12.

Thanks in advance!

date_hour

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

There is no time "00:59 AM". 59 minutes after midnight is "12:59 AM", 59 minutes after noon is "12:59 PM". The 24-hour clock has "00:59" for 59 minutes after midnight, but no AM/PM distinction.

0 Karma

shangshin
Builder

I assume there is no way to change the index value. As the alternative, I am planning to use

| eval new_date_hour = strftime(_time,"%H")

0 Karma

somesoni2
Revered Legend

Try this

| eval desired_time=strftime(_time,"%m/%d/%y %I:%M:%S.%3q %p")

shangshin
Builder

Thanks for the response. I still got the value 12 for date_hour instead of 00

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...