<?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 to calculate the difference between a specific date  and the last 60 days? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238688#M176553</link>
    <description>&lt;P&gt;index=xyz| eval OldTime = relative_time(now(),"-60d") | table OldTime timestamp | eval OldTime=strftime(OldTime,"%Y-%m-%d %H:%M:%S")&lt;/P&gt;

&lt;P&gt;This should work @balleste&lt;/P&gt;</description>
    <pubDate>Fri, 07 Oct 2016 12:36:38 GMT</pubDate>
    <dc:creator>vr2312</dc:creator>
    <dc:date>2016-10-07T12:36:38Z</dc:date>
    <item>
      <title>How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238686#M176551</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following output:&lt;/P&gt;

&lt;P&gt;"ACME Enterprises","227671","&lt;A href="mailto:bugs.bunny@acme.com"&gt;bugs.bunny@acme.com&lt;/A&gt;","","","2016-10-01","14:18:11","Entertainment","Test"&lt;/P&gt;

&lt;P&gt;I wanted to calculate today's date minus the date in the output (2016-06-30) and table like so:&lt;/P&gt;

&lt;P&gt;ACME Enterprises, 2016-06-30, 6&lt;/P&gt;

&lt;P&gt;Any help would be great.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 10:35:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238686#M176551</guid>
      <dc:creator>balleste</dc:creator>
      <dc:date>2016-10-07T10:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238687#M176552</link>
      <description>&lt;P&gt;Not very sure if I understood your question. You want to take 07/Oct - 01/Oct and receive 30/Jun??&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 11:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238687#M176552</guid>
      <dc:creator>gfreitas</dc:creator>
      <dc:date>2016-10-07T11:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238688#M176553</link>
      <description>&lt;P&gt;index=xyz| eval OldTime = relative_time(now(),"-60d") | table OldTime timestamp | eval OldTime=strftime(OldTime,"%Y-%m-%d %H:%M:%S")&lt;/P&gt;

&lt;P&gt;This should work @balleste&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:36:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238688#M176553</guid>
      <dc:creator>vr2312</dc:creator>
      <dc:date>2016-10-07T12:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238689#M176554</link>
      <description>&lt;P&gt;There is no built-in function to subtract dates.  You must first convert both dates into epoch form, do the calculation, then convert the result into readable form.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval eDate = strptime(&amp;lt;your date field&amp;gt;,"%Y/%m/%d") | eval days = (now() - eDate)/86400 | table foo, &amp;lt;your date field&amp;gt;, days
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:50:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238689#M176554</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-10-07T12:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238690#M176555</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;...|convert mktime(_time) as time|eval days=round((now()-time)/86400,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;possibly something like this. mktime converts human readable to epoch, then using that to subtract from the current timestamp and dividing by the seconds in a day, that should give you total days.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 14:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238690#M176555</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-10-07T14:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between a specific date  and the last 60 days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238691#M176556</link>
      <description>&lt;P&gt;You need to use &lt;CODE&gt;epoch&lt;/CODE&gt; times and the &lt;CODE&gt;relative_time&lt;/CODE&gt; command with &lt;CODE&gt;-60d&lt;/CODE&gt;:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/CommonEvalFunctions"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Oct 2016 20:53:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-a-specific-date-and-the/m-p/238691#M176556</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-10-08T20:53:50Z</dc:date>
    </item>
  </channel>
</rss>

