<?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: How can I manage relative time values passed from a time input and convert to epoch time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315766#M162675</link>
    <description>&lt;P&gt;Great! I converted it to an answer so you can accept it to help others find it in the future. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 19:35:56 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2018-02-28T19:35:56Z</dc:date>
    <item>
      <title>How can I manage relative time values passed from a time input and convert to epoch time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315763#M162672</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to convert all possible values set in a time input to epoch time format.  This means that it should manage values like:  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;-d@d&lt;/CODE&gt; &lt;CODE&gt;@w&lt;/CODE&gt; &lt;CODE&gt;now&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;i have found similar threads like &lt;A href="https://answers.splunk.com/answers/145346/convert-timerange-to-epoch-values.html"&gt;this&lt;/A&gt; which recommend the &lt;CODE&gt;relative_time()&lt;/CODE&gt; function, but it doesn't manage all cases.  I also found a thread about filtering all values in a time input within a search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where if("$time_input.earliest$"!="0" AND "$time_input.earliest$"!="",_time&amp;gt;=if(replace("$time_input.earliest$","\d","")!="",relative_time(now(),if("$time_input.earliest$"="now","-0m","$time_input.earliest$")),"$time_input.earliest$"),0=0) AND if("$time_input.latest$"!="0" AND "$time_input.latest$"!="",_time&amp;lt;if(replace("$time_input.latest$","\d","")!="",relative_time(now(),if("$time_input.latest$"="now","-0m","$time_input.latest$")),"$time_input.latest$"),0=0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but I cannot figure out how to convert this for use in an &lt;CODE&gt;eval&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Could somebody help me out?&lt;/P&gt;

&lt;P&gt;Thank you and best regards,&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 16:08:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315763#M162672</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-28T16:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I manage relative time values passed from a time input and convert to epoch time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315764#M162673</link>
      <description>&lt;P&gt;Is the timepicker being used to set the parameters of the search? If so, you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addinfo
| eval early_time=info_min_time, late_time=info_max_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And if you don't like having the extra info* fields, you can follow that with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| fields - info_max_time info_min_time info_search_time info_sid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 17:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315764#M162673</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-28T17:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I manage relative time values passed from a time input and convert to epoch time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315765#M162674</link>
      <description>&lt;P&gt;@elliotproebstel this is perfect!  No conversions required!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315765#M162674</guid>
      <dc:creator>andrewtrobec</dc:creator>
      <dc:date>2018-02-28T19:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I manage relative time values passed from a time input and convert to epoch time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315766#M162675</link>
      <description>&lt;P&gt;Great! I converted it to an answer so you can accept it to help others find it in the future. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 19:35:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-manage-relative-time-values-passed-from-a-time-input/m-p/315766#M162675</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-28T19:35:56Z</dc:date>
    </item>
  </channel>
</rss>

