<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: What's the Token name for the Time Picker's display value, if any? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290090#M18414</link>
    <description>&lt;P&gt;It's because of the 'beginning of the day' option which breaks it. Happens to me every once in awhile. If you just re-pick from relative and not the presets it works. &lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 18:19:45 GMT</pubDate>
    <dc:creator>hallt3</dc:creator>
    <dc:date>2019-05-29T18:19:45Z</dc:date>
    <item>
      <title>What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290080#M18404</link>
      <description>&lt;P&gt;I have a Simple XML Dashboard using a Time Picker.  Some panels are affected by the Time Picker, and some aren't.  I'd like to specify in the panel title which panels are affected by the Time Picker by inserting the picked time into the panel.&lt;/P&gt;

&lt;P&gt;I know how to do that using $token.earliest$ and $token.latest$, but Splunk provides much more aesthetic value in the time picker itself, e.g. "Today", "Yesterday", "During Wed, March 21, 2018".  I'm wondering if that value is stored somewhere accessible to me.&lt;/P&gt;

&lt;P&gt;I spent a couple of hours reading through the documentation that should be relevant (&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/PanelreferenceforSimplifiedXML"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/PanelreferenceforSimplifiedXML&lt;/A&gt; &amp;amp; &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/tokens"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/tokens&lt;/A&gt;), but I couldn't find an answer.&lt;/P&gt;

&lt;P&gt;Basically I want to know how to do this:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4624iFC6AC71B96932216/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290080#M18404</guid>
      <dc:creator>ksextonmacb</dc:creator>
      <dc:date>2018-03-26T14:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290081#M18405</link>
      <description>&lt;P&gt;Hey&lt;/P&gt;

&lt;P&gt;Sorry about last answer.&lt;/P&gt;

&lt;P&gt;I'm not sure how to get that info from the tokens. But you could certainly create a new token in the dashboard, formatted the way you want, using EVAL and srtftime to put in the title of the panel.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290081#M18405</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-26T14:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290082#M18406</link>
      <description>&lt;P&gt;Alright, I'll look into that.  Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:28:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290082#M18406</guid>
      <dc:creator>ksextonmacb</dc:creator>
      <dc:date>2018-03-26T14:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290083#M18407</link>
      <description>&lt;P&gt;Hi ksextonmacb,&lt;BR /&gt;
see at &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/tokens"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.2/Viz/tokens&lt;/A&gt; the way to use tokens from a panel in panel's title.&lt;BR /&gt;
Instead using token from Tome Picker,you could use &lt;CODE&gt;$job.earliestTime$&lt;/CODE&gt; and &lt;CODE&gt;$job.latestTime$&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290083#M18407</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-03-26T14:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290084#M18408</link>
      <description>&lt;P&gt;Used this page for help with using eval and a time picker: &lt;A href="https://answers.splunk.com/answers/334498/how-to-use-eval-on-a-token-from-a-time-picker-and.html"&gt;https://answers.splunk.com/answers/334498/how-to-use-eval-on-a-token-from-a-time-picker-and.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ultimately, this does not work when picking dates such as "Today" or "Yesterday". srtftime outputs "Invalid Date"&lt;/P&gt;

&lt;P&gt;It does work if you pick a date range, though.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 14:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290084#M18408</guid>
      <dc:creator>ksextonmacb</dc:creator>
      <dc:date>2018-03-26T14:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290085#M18409</link>
      <description>&lt;P&gt;@ksextonmacb, The Preset names in the Time Picker come from &lt;CODE&gt;Time ranges User Interface&lt;/CODE&gt; element. While most of these are built in you can create custom Time Ranges from &lt;CODE&gt;Settings &amp;gt; User Interface &amp;gt; Time ranges&lt;/CODE&gt; menu, provided you have the access.&lt;/P&gt;

&lt;P&gt;These &lt;CODE&gt;Time ranges&lt;/CODE&gt; can be access via the &lt;CODE&gt;REST API&lt;/CODE&gt; &lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt; &lt;CODE&gt;| rest services/data/ui/times&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;As far as you are picking up Time Ranges from &lt;CODE&gt;Presets&lt;/CODE&gt; section of the Time input, the above REST API call should give you the Selected Time Label. Else I have used &lt;CODE&gt;$job.earliestTime$&lt;/CODE&gt; and &lt;CODE&gt;$job.latestTime$&lt;/CODE&gt; to pick up and show static &lt;CODE&gt;From&lt;/CODE&gt; and &lt;CODE&gt;To&lt;/CODE&gt; dates in &lt;CODE&gt;YYYY-mm-dd HH:MM:SS&lt;/CODE&gt; format. You can format as per your needs. Refer to my previous answer for getting the selected time from Time input: &lt;A href="https://answers.splunk.com/answers/578984/running-one-of-two-searches-based-on-time-picker-s.html"&gt;https://answers.splunk.com/answers/578984/running-one-of-two-searches-based-on-time-picker-s.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4623i7A923C67556BC0A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Following is a run anywhere dashboard code for the screenshot attached (please try out and confirm):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Preset Name based on Selection&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| makeresults
    &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;eval token="tokManuallySelectedTime"&amp;gt;"From ".strftime(strptime($job.earliestTime$,"%Y/%m/%d %H:%M:%S"),"%Y/%m/%d %H:%M:%S")." to ".strftime(strptime($job.latestTime$,"%Y/%m/%d %H:%M:%S"),"%Y/%m/%d %H:%M:%S")&amp;lt;/eval&amp;gt;
      &amp;lt;eval token="tokEarliestTime"&amp;gt;strptime($job.earliestTime$,"%Y/%m/%d %H:%M:%S")&amp;lt;/eval&amp;gt;
      &amp;lt;eval token="tokLatestTime"&amp;gt;strptime($job.latestTime$,"%Y/%m/%d %H:%M:%S")&amp;lt;/eval&amp;gt;
    &amp;lt;/done&amp;gt;
    &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Select Time&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;$tokDisplaySelectedTime$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| rest services/data/ui/times 
| search earliest_time="$tokTime.earliest$" latest_time="$tokTime.latest$"
| fields earliest_time latest_time label
| append [| makeresults
| eval earliest_time=strftime("$tokEarliestTime$","%Y/%m/%d %H:%M:%S"), latest_time=strftime("$tokLatestTime$","%Y/%m/%d %H:%M:%S"), label="$tokManuallySelectedTime$"
| fields - _time]
| head 1&amp;lt;/query&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
              &amp;lt;set token="tokDisplaySelectedTime"&amp;gt;$tokManuallySelectedTime$&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition&amp;gt;
              &amp;lt;set token="tokDisplaySelectedTime"&amp;gt;$result.label$&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 17:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290085#M18409</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-26T17:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290086#M18410</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;That's more complicated that I'd anticipated, but it's exactly what I was looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 17:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290086#M18410</guid>
      <dc:creator>ksextonmacb</dc:creator>
      <dc:date>2018-03-26T17:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290087#M18411</link>
      <description>&lt;P&gt;@ksextonmacb, if you &lt;CODE&gt;just want earliest time as relative time&lt;/CODE&gt; compared to what you have selected try the following run anywhere search ( &lt;CODE&gt;However this will not  account for latest time other than now&lt;/CODE&gt; ) which is based on &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Reltime"&gt;reltime&lt;/A&gt; command which works on &lt;CODE&gt;_time&lt;/CODE&gt; field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| addinfo
| eval _time=info_min_time
| fields _time
| reltime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 17:36:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290087#M18411</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-26T17:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290088#M18412</link>
      <description>&lt;P&gt;I've used &lt;CODE&gt;$label$&lt;/CODE&gt; along with &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; and been mostly successful with it.  The only weak point is that it doesn't always pick up the default value on the first time the screen loads and will display the system default (still on 6.5.2, so it's "All time").  Code as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;input type="time" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Enter time range&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-1d@d&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;@d&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="displayTime"&amp;gt;($label$)&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that this only works for the simple values (Yesterday, etc.)  But in this case I was looking to keep the dashboard as simple as possible.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 17:51:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290088#M18412</guid>
      <dc:creator>Kenshiro70</dc:creator>
      <dc:date>2018-06-16T17:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290089#M18413</link>
      <description>&lt;P&gt;Hi Kenshiro,&lt;/P&gt;

&lt;P&gt;I tried your solution above using $label$ token, it was working fine for me. But after doing the upgrade from version 6.6.3 to 7.2.1 (latest version), I think it got broke. &lt;/P&gt;

&lt;P&gt;When I keep "Last 7 days" as default, it show as "custom time"  in the panel title. But when I change it to "last 24 hours" or other selection from timerange picker, it displays it properly. can you help resolve this issue please ?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 07:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290089#M18413</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2018-12-12T07:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290090#M18414</link>
      <description>&lt;P&gt;It's because of the 'beginning of the day' option which breaks it. Happens to me every once in awhile. If you just re-pick from relative and not the presets it works. &lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290090#M18414</guid>
      <dc:creator>hallt3</dc:creator>
      <dc:date>2019-05-29T18:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290091#M18415</link>
      <description>&lt;P&gt;This is how I do it. it's a better answer.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:21:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290091#M18415</guid>
      <dc:creator>hallt3</dc:creator>
      <dc:date>2019-05-29T18:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: What's the Token name for the Time Picker's display value, if any?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290092#M18416</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
it's show "From Invalid date to Invalid date" when i choose date range, but when choose from relative time it works &lt;BR /&gt;
my splunk version is 7.3.3, is there any change in this version&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 09:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/What-s-the-Token-name-for-the-Time-Picker-s-display-value-if-any/m-p/290092#M18416</guid>
      <dc:creator>imanwibisono</dc:creator>
      <dc:date>2020-02-04T09:44:18Z</dc:date>
    </item>
  </channel>
</rss>

