Show log timestamps in 24hr time, not am/pm
I can set my clock to UTC, but it appears search results still display logs in 12hr am/pm format. Is there a way to display them as 24hr timestamps?
-
Official comment
Hi Justin,
If you’d like to change the displayed time format, you can add a query with the formatDate operator, and then (optionally) add the fields operator to specify which fields you want to display.
Here is an example:
| formatDate(toLong(_messageTime), "yyyy-MM-dd HH:mm") as date
| fields date, <other fields you’d like to display>To see the 24h format, you can use "yyyy-MM-dd HH:mm" like in my example query, or any other format from the “Timestamp Format” table, just remember that:
- using capital “HH” changes the hour format to 24h, and small “hh” will show it in 12h format, e.g.:
- "yyyy-MM-dd HH:mm" will show the date as “2022-10-26 14:39”
- "yyyy-MM-dd hh:mm" will show the date as “2022-10-26 02:39”
- adding “a” to the format will display the AM/PM, e.g.:
- "yyyy-MM-dd hh:mm a" will show the date as “2022-10-26 02:39 PM”
- adding “zzz” will show the timezone, e.g.:
- “yyyy-MM-dd HH:mm zzz" will show the date as “2022-10-26 14:39 CEST”
If you’d like to check the meaning of each token used in the timestamp formats, the Timestamp conventions section has it covered.
Hope that helps!Comment actions
Please sign in to leave a comment.
Comments
1 comment