<?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 get the difference (In whole days) between two fields within the same event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550519#M156223</link>
    <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if you can help me out with the following. Within a single event I have to fields:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) expiry_date&lt;/P&gt;&lt;P&gt;2) delivery_date&lt;/P&gt;&lt;P&gt;I would create a new variable giving me the difference in days between the delivery date and the expiry date for each order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expiry_date=&lt;/SPAN&gt;&lt;SPAN&gt;2021-05-25T00:00:00Z&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;delivery_date=&lt;/SPAN&gt;&lt;SPAN&gt;2021-04-27T19:00:44Z&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Should give a result of 28days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help! Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 May 2021 12:45:49 GMT</pubDate>
    <dc:creator>Matthew</dc:creator>
    <dc:date>2021-05-05T12:45:49Z</dc:date>
    <item>
      <title>How to get the difference (In whole days) between two fields within the same event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550519#M156223</link>
      <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wondering if you can help me out with the following. Within a single event I have to fields:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) expiry_date&lt;/P&gt;&lt;P&gt;2) delivery_date&lt;/P&gt;&lt;P&gt;I would create a new variable giving me the difference in days between the delivery date and the expiry date for each order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;expiry_date=&lt;/SPAN&gt;&lt;SPAN&gt;2021-05-25T00:00:00Z&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;delivery_date=&lt;/SPAN&gt;&lt;SPAN&gt;2021-04-27T19:00:44Z&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Should give a result of 28days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you can help! Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 May 2021 12:45:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550519#M156223</guid>
      <dc:creator>Matthew</dc:creator>
      <dc:date>2021-05-05T12:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the difference (In whole days) between two fields within the same event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550524#M156224</link>
      <description>&lt;P&gt;Here you go&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_query&amp;gt;
| eval diff=tostring(strptime(expiry_date, "%Y-%m-%dT%H:%M:%S%Z")-strptime(delivery_date, "%Y-%m-%dT%H:%M:%S%Z"), "duration")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample query which I ran&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval expiry_date="2021-05-25T00:00:00Z", delivery_date="2021-04-27T19:00:44Z"
| eval diff=tostring(strptime(expiry_date, "%Y-%m-%dT%H:%M:%S%Z")-strptime(delivery_date, "%Y-%m-%dT%H:%M:%S%Z"), "duration")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 May 2021 13:26:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550524#M156224</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2021-05-05T13:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the difference (In whole days) between two fields within the same event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550965#M156329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;harsmarvania57,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Worked like a charm. Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 08 May 2021 14:47:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-difference-In-whole-days-between-two-fields/m-p/550965#M156329</guid>
      <dc:creator>Matthew</dc:creator>
      <dc:date>2021-05-08T14:47:31Z</dc:date>
    </item>
  </channel>
</rss>

