Dashboards & Visualizations

how to format and use time picker values in panel title?

stwong
Communicator

Hi, is it possible to format time picker value, e.g. $earliest$ and $latest$, in panel title? If i do something like this:

 <title>Total access for department $d_name$ between $earliest$ and $latest$</title>

It gives raw time format, or the relative values like -4d@d. We hope to print the values in yyyymmdd HH:MM:SS in title. Please help.

Thanks a lot.

/ST Wong

0 Karma
1 Solution

gokadroid
Motivator

Can you first try to evaluate the string you are interested in as tokens using eval and then use those tokens in the title. Say the token of your timepicker is myTimepicker then try something like this and see if it works out:

<eval token="fromDate">strftime($myTimepicker.earliest$,"%Y%m/%d %H:%M:%S")</eval>
<eval token="toDate">strftime($myTimepicker.latest$, "%Y%m/%d %H:%M:%S")</eval>

And then later use $fromDate$ and $toDate$ in the panel title.

View solution in original post

0 Karma

stwong
Communicator

Hi all,

Thanks for your help. Both ways work with custom time range is selected. However, strftime doesn't understand relative time specifiers like -30m@m, which is used quite frequently by our users.

Thanks again.

0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@stwong - It looks like you found a solution to your question? If one of them provided a working solution, please don't forget to click "Accept" below the best answer to resolve this post so that it can easily be found by other users in the same situation. Don’t forget to upvote anything that was helpful too. Thanks!

0 Karma

stwong
Communicator

Got it. Thanks.

0 Karma

gokadroid
Motivator

You are welcome!

0 Karma

somesoni2
Revered Legend

Try this runanywhere sample

<form>
  <label>TobeDeleted</label>
  <fieldset submitButton="false">
    <input type="time" token="timerange" searchWhenChanged="true">
      <label>Time Range</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
      </input>
  </fieldset>
  <search>
        <query>| gentimes start=-1 | addinfo </query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <done>
          <eval token="Tearliest">strftime($result.info_min_time$,"%F %T")</eval>
          <eval token="Tlatest">strftime($result.info_max_time$,"%F %T")</eval>
        </done>
      </search>
  <row>
    <panel>
      <table>
        <title>Showing data between $Tearliest$ and $Tlatest$</title>
        <search>
          <query>|gentimes start=-1 | eval Message="Dummy Panel" | table Message </query>
          <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        </search>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">row</option>
        <option name="count">10</option>
      </table>      
    </panel>
  </row>
</form>

gokadroid
Motivator

Can you first try to evaluate the string you are interested in as tokens using eval and then use those tokens in the title. Say the token of your timepicker is myTimepicker then try something like this and see if it works out:

<eval token="fromDate">strftime($myTimepicker.earliest$,"%Y%m/%d %H:%M:%S")</eval>
<eval token="toDate">strftime($myTimepicker.latest$, "%Y%m/%d %H:%M:%S")</eval>

And then later use $fromDate$ and $toDate$ in the panel title.

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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...