<?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 How to convert earliest and latest into String values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140863#M38964</link>
    <description>&lt;P&gt;I would like to convert a earliest and latest time and concatenate in a string value, so I could have that in my Dashboard. E.g.&lt;BR /&gt;
"Report: January 1 – 31, 2015"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | head 4 | eval desired_time=strftime(now(), "%B") | eval month_year=strftime(now(),"%d %Y") | eval fulldate = desired_time." ".month_year | table fulldate, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Feb 2015 19:57:04 GMT</pubDate>
    <dc:creator>celsohso</dc:creator>
    <dc:date>2015-02-10T19:57:04Z</dc:date>
    <item>
      <title>How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140863#M38964</link>
      <description>&lt;P&gt;I would like to convert a earliest and latest time and concatenate in a string value, so I could have that in my Dashboard. E.g.&lt;BR /&gt;
"Report: January 1 – 31, 2015"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main | head 4 | eval desired_time=strftime(now(), "%B") | eval month_year=strftime(now(),"%d %Y") | eval fulldate = desired_time." ".month_year | table fulldate, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Feb 2015 19:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140863#M38964</guid>
      <dc:creator>celsohso</dc:creator>
      <dc:date>2015-02-10T19:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140864#M38965</link>
      <description>&lt;P&gt;Not sure I understand completely, but &lt;CODE&gt;stats first()/last()&lt;/CODE&gt; will give you youngest and oldest event timestamp for any given search (does not necessarily match earliest/latest). Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main earliest=-2d | stats last(_time) as earliest first(_time) as latest 
| eval startDate=strftime(earliest, "%B %d %Y") 
| eval endDate=strftime(latest, "%B %d %Y") 
| eval reportstring = "Report: ".startDate."-".endDate
| fields reportstring
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that's not what you meant, please clarify your requirement.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 21:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140864#M38965</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2015-02-10T21:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140865#M38966</link>
      <description>&lt;P&gt;ssievert_splunk&lt;/P&gt;

&lt;P&gt;I was asked to add a Header to my report with the timeframe I am reporting for. E.g. "Report: January 1 – 31, 2015", so that it would show up as a header on all the PDF pages.&lt;/P&gt;

&lt;P&gt;I don't know why this search is not working for me&lt;/P&gt;

&lt;P&gt;Thanks a lot for your help so far&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 21:31:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140865#M38966</guid>
      <dc:creator>celsohso</dc:creator>
      <dc:date>2015-02-10T21:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140866#M38967</link>
      <description>&lt;P&gt;I would like to use:&lt;/P&gt;

&lt;P&gt;earliest=-30d@d and latest=@d&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 21:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140866#M38967</guid>
      <dc:creator>celsohso</dc:creator>
      <dc:date>2015-02-10T21:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140867#M38968</link>
      <description>&lt;P&gt;you can use whatever values you need for your earliest/latest search timeframe constraints.&lt;/P&gt;

&lt;P&gt;This answer &lt;A href="http://answers.splunk.com/answers/154991/how-to-include-time-range-in-pdf.html"&gt;here&lt;/A&gt;, I think, is what you are really asking, i.e. how can you put the report timeframe at the top of a report so that it gets captured in the PDF when delivered. The answer shows how to use a single-value panel at the top of your report that you can populate with the String you wish to use. I showed you above how to put together that string.&lt;/P&gt;

&lt;P&gt;BTW, what version of Splunk are you using? &lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 21:36:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140867#M38968</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2015-02-10T21:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert earliest and latest into String values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140868#M38969</link>
      <description>&lt;P&gt;ssievert_splunk,&lt;/P&gt;

&lt;P&gt;Your answer plus the link you gave me work perfectly.&lt;/P&gt;

&lt;P&gt;thank you so much for all your help, outstanding!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Feb 2015 22:18:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-earliest-and-latest-into-String-values/m-p/140868#M38969</guid>
      <dc:creator>celsohso</dc:creator>
      <dc:date>2015-02-10T22:18:02Z</dc:date>
    </item>
  </channel>
</rss>

