<?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: calculating date and int columns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600505#M209044</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245944"&gt;@ositaumeozulu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to make calculations between dates you have always to convert dates in epochtime,&lt;/P&gt;&lt;P&gt;I don't know what's the format of&amp;nbsp;&lt;SPAN&gt;lastpickupdate and IIT, I suppose that it's "yyyy-mm-dd HH:MM:SS",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So you could run something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval  InT = if(((strptime(lastpickupdate,"%Y-%m-%d %H:%M:%S") + DaysOfARVRefil*86400  + 28*86400) &amp;gt; strptime(IIT,"%Y-%m-%d %H:%M:%S")), "Interrupted", "Active")&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 15:56:53 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-06-03T15:56:53Z</dc:date>
    <item>
      <title>How to calculate date and int columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600502#M209042</link>
      <description>&lt;P&gt;please i will be glad to get answer to this query&lt;/P&gt;
&lt;P&gt;| eval&amp;nbsp; InT = if(((lastpickupdate + DaysOfARVRefil&amp;nbsp; + 28) &amp;gt; IIT), "Interrupted", "Active")&lt;/P&gt;
&lt;P&gt;"lastpickupdate" and "IIT" columns are in date format, whereas "DaysOfARVRefil" is in Days(int)&lt;/P&gt;
&lt;P&gt;please how do i successfully run this query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;osita&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 03:20:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600502#M209042</guid>
      <dc:creator>ositaumeozulu</dc:creator>
      <dc:date>2022-06-06T03:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: calculating date and int columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600504#M209043</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval  InT = if((strptime(lastpickupdate,"%Y-%m-%d") + (DaysOfARVRefil  + 28)*86400) &amp;gt; strptime(IIT,"%Y-%m-%d"), "Interrupted", "Active")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;(assuming both lastpickupdate and IIT has date in string&amp;nbsp; and have format&amp;nbsp; "%Y-%m-%d". If they are different, adjust the time format accordingly)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 15:55:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600504#M209043</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-06-03T15:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: calculating date and int columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600505#M209044</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245944"&gt;@ositaumeozulu&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;to make calculations between dates you have always to convert dates in epochtime,&lt;/P&gt;&lt;P&gt;I don't know what's the format of&amp;nbsp;&lt;SPAN&gt;lastpickupdate and IIT, I suppose that it's "yyyy-mm-dd HH:MM:SS",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So you could run something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval  InT = if(((strptime(lastpickupdate,"%Y-%m-%d %H:%M:%S") + DaysOfARVRefil*86400  + 28*86400) &amp;gt; strptime(IIT,"%Y-%m-%d %H:%M:%S")), "Interrupted", "Active")&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 15:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600505#M209044</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-06-03T15:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculating date and int columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600506#M209045</link>
      <description>&lt;P&gt;Splunk cannot do much with dates in string format.&amp;nbsp; They should be converted into integers using the &lt;FONT face="courier new,courier"&gt;strptime&lt;/FONT&gt; function first.&amp;nbsp; Also, the number of days should be converted into seconds before it is added to a timestamp.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval lastpickupts = strptime(lastpickupdate, "&amp;lt;&amp;lt;format string&amp;gt;&amp;gt;")
| eval IITts = strptime(IIT, "&amp;lt;&amp;lt;format string&amp;gt;&amp;gt;")
| eval SecsOfARVRefil = (DaysOfARVRefil + 28) * 86400
| eval  InT = if(((lastpickupts + SecsOfARVRefil ) &amp;gt; IITts), "Interrupted", "Active")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Jun 2022 16:00:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-date-and-int-columns/m-p/600506#M209045</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-06-03T16:00:31Z</dc:date>
    </item>
  </channel>
</rss>

