<?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 two dates? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611658#M212648</link>
    <description>&lt;P&gt;Dates can only be compared/calculated in integer (epoch) form.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval remediation_days = (strptime(last_fixed, "%Y-%m-%dT%H:%M:%S.%3N%Z") - strptime(first_found, "%Y-%m-%dT%H:%M:%S.%3N%Z") / 86400)
&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 01 Sep 2022 18:28:46 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-09-01T18:28:46Z</dc:date>
    <item>
      <title>How to calculate the difference between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611649#M212641</link>
      <description>&lt;P&gt;I have 2 dates&lt;/P&gt;
&lt;P&gt;&lt;A href="https://es-idmesec.splunkcloud.com/en-US/app/search/search?earliest=-30d%40d&amp;amp;latest=now&amp;amp;q=search%20index%20%3D%20tenable%20state%3Dfixed%0A%7C%20table%20asset_hostname%20state%20first_found%20last_fixed%20severity%20plugin.id&amp;amp;display.page.search.mode=fast&amp;amp;dispatch.sample_ratio=1&amp;amp;display.general.type=statistics&amp;amp;display.page.search.tab=statistics&amp;amp;sid=1662054448.224734#" target="_blank" rel="noopener"&gt;first_found:&amp;nbsp;&lt;SPAN&gt;2022-08-23T21:08:54.808Z&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://es-idmesec.splunkcloud.com/en-US/app/search/search?earliest=-30d%40d&amp;amp;latest=now&amp;amp;q=search%20index%20%3D%20tenable%20state%3Dfixed%0A%7C%20table%20asset_hostname%20state%20first_found%20last_fixed%20severity%20plugin.id&amp;amp;display.page.search.mode=fast&amp;amp;dispatch.sample_ratio=1&amp;amp;display.general.type=statistics&amp;amp;display.page.search.tab=statistics&amp;amp;sid=1662054448.224734#" target="_blank" rel="noopener"&gt;last_fixed:2022-08-30T12:56:58.860Z&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am trying to calculate the difference in days between (first-found - last_fixed) and dump the result in a new field called "remediation_days"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 18:27:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611649#M212641</guid>
      <dc:creator>marceldera</dc:creator>
      <dc:date>2022-09-01T18:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611658#M212648</link>
      <description>&lt;P&gt;Dates can only be compared/calculated in integer (epoch) form.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval remediation_days = (strptime(last_fixed, "%Y-%m-%dT%H:%M:%S.%3N%Z") - strptime(first_found, "%Y-%m-%dT%H:%M:%S.%3N%Z") / 86400)
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Sep 2022 18:28:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611658#M212648</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-01T18:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611671#M212653</link>
      <description>&lt;P&gt;It works, however the results come back like this.&amp;nbsp;&lt;SPAN&gt;2419200.000000 even after i do the division.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 19:52:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611671#M212653</guid>
      <dc:creator>marceldera</dc:creator>
      <dc:date>2022-09-01T19:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611672#M212654</link>
      <description>&lt;P&gt;Parens error on my part.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval remediation_days = (strptime(last_fixed, "%Y-%m-%dT%H:%M:%S.%3N%Z") - strptime(first_found, "%Y-%m-%dT%H:%M:%S.%3N%Z")) / 86400&lt;/LI-CODE&gt;&lt;P&gt;There's also this alternative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval remediation_secs = strptime(last_fixed, "%Y-%m-%dT%H:%M:%S.%3N%Z") - strptime(first_found, "%Y-%m-%dT%H:%M:%S.%3N%Z")
| eval remediation_days = round(remediation_secs / 86400, 2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 20:02:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-difference-between-two-dates/m-p/611672#M212654</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-09-01T20:02:51Z</dc:date>
    </item>
  </channel>
</rss>

