<?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 Changing date format and find date difference in days? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619508#M106814</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I want to change the date format and find difference in days from current day .&lt;/P&gt;
&lt;P&gt;Date format i&amp;nbsp; have now is ,&lt;/P&gt;
&lt;P&gt;Timestamp&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;10/31/2022 1:28:20 PM&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=s sourcetype=Resources|fillnull
| eval Timestamp=strftime(strptime('Timestamp',"%m/%d/%Y"),"%Y-%m-%d") | eval diff=now()-Timestamp|table Name _time Timestamp diff&lt;/LI-CODE&gt;
&lt;P&gt;Here i am not getting the diff field populated with difference in number of days.It shows as blank .The date format i expect is %Y-%m-%d for timestamp&amp;nbsp; column.&lt;/P&gt;
&lt;P&gt;Please help me to achieve this .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 18:22:37 GMT</pubDate>
    <dc:creator>dtccsundar</dc:creator>
    <dc:date>2022-11-03T18:22:37Z</dc:date>
    <item>
      <title>Changing date format and find date difference in days?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619508#M106814</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I want to change the date format and find difference in days from current day .&lt;/P&gt;
&lt;P&gt;Date format i&amp;nbsp; have now is ,&lt;/P&gt;
&lt;P&gt;Timestamp&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;10/31/2022 1:28:20 PM&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=s sourcetype=Resources|fillnull
| eval Timestamp=strftime(strptime('Timestamp',"%m/%d/%Y"),"%Y-%m-%d") | eval diff=now()-Timestamp|table Name _time Timestamp diff&lt;/LI-CODE&gt;
&lt;P&gt;Here i am not getting the diff field populated with difference in number of days.It shows as blank .The date format i expect is %Y-%m-%d for timestamp&amp;nbsp; column.&lt;/P&gt;
&lt;P&gt;Please help me to achieve this .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 18:22:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619508#M106814</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2022-11-03T18:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: changing date format and find date difference in days</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619511#M106815</link>
      <description>&lt;P&gt;In order to do arithmetic on time values they need to be in epoch form so save the epoch time returned by strptime() so you can subtract it from now()&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=s sourcetype=Resources
|fillnull
| eval time=strptime('Timestamp',"%m/%d/%Y")
| eval Timestamp=strftime(time,"%Y-%m-%d")  
| eval diff=now()-time
|table Name _time Timestamp diff&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 03 Nov 2022 16:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619511#M106815</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-11-03T16:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: changing date format and find date difference in days</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619527#M106817</link>
      <description>&lt;P&gt;Thank you .It worked as expected .&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 18:15:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Changing-date-format-and-find-date-difference-in-days/m-p/619527#M106817</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2022-11-03T18:15:15Z</dc:date>
    </item>
  </channel>
</rss>

