Dashboards & Visualizations

date format

owulz
Explorer

Hi I have two date fields that show up in my dash board panel that lists events after visualisation panels.

"2021-11-02 16:53:38" and "11/02/21 at 16:52:37"

I am trying to find a way to reformat the second date (right) to be like the first.

YYYY-MM-DD hh:mm:ss

Is there an easy way?

This is a search query inside a table listing.

Thank you

Labels (1)
0 Karma
1 Solution

manjunathmeti
SplunkTrust
SplunkTrust

hi @owulz,

Use strptime and strftime functions.

| eval seconddatetime=strftime(strptime(seconddatetime, "%d/%m/%y at %H:%M:%S"), "%Y-%d-%m %H:%M:%S")

 

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

manjunathmeti
SplunkTrust
SplunkTrust

hi @owulz,

Use strptime and strftime functions.

| eval seconddatetime=strftime(strptime(seconddatetime, "%d/%m/%y at %H:%M:%S"), "%Y-%d-%m %H:%M:%S")

 

If this reply helps you, an upvote/like would be appreciated.

owulz
Explorer

Thanks so much @manjunathmeti !

0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

You're welcome! You can accept the answer and give it a thumbs up.

0 Karma
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 ...