Dashboards & Visualizations

How to convert TimeRangeView selected values to a human readable format in my dashboard header?

kasu_praveen
Communicator

I have a dashboard where I am using TimeRangeView control.
I would like to display the TimeRangeView control selected value as human readable format in my dashboard header.
unfortunately, I don't have the option to run a Splunk search in this case.

Ex:
Imagine current time is 14:12:00 03/09/2015, then
1) If TimeRangeView control selected value is -1m@m, then it should print as 14:11:00 03/Sep/2015
2) If TimeRangeView control selected value is -4h@m, then it should print as 10:12:00 03/Sep/2015
3) If TimeRangeView control selected value is -2d@h, then it should print as 14:12:00 01/Sep/2015

Any help on this is much appreciated.
Thanks.

1 Solution

kasu_praveen
Communicator

Unfortunately, I don't have option to run Splunk search in this case.
Anything with Javascript or otherways to convert the TimeRangeView control selected values to epoch time will be helpful

0 Karma

jandre01
Splunk Employee
Splunk Employee

Use the moment.js library.

kasu_praveen
Communicator

moment.js works in this case. Sorry for delayed response in this forum.

0 Karma

miteshvohra
Contributor

Check if this one works for you: ... | fieldformat time_field = strftime(time_field, "%H:%M:%S %d/%b/%Y")

kasu_praveen
Communicator

Unfortunately, I don't have option to run Splunk search in this case.
Anything with Javascript or otherways to convert the TimeRangeView control selected values to epoch time will be helpful

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