<?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 get data by comparing with a date field and current date in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631509#M51791</link>
    <description>&lt;P class="lia-align-left"&gt;Here's a simple example that generates 20 dates within one year before or after today and makes that date YYYY-MM-DD.&lt;/P&gt;&lt;P class="lia-align-left"&gt;The where clause simply checks that date is &amp;gt;= today&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=20
``` Make up a random sample of expiry dates within 1 uyear before and after today ```
| eval r=365
| eval range=random() % (r * 2 * 86400) 
| eval "Expire valid To"=strftime(now() + (r * 86400) - range, "%F")
``` Now simply test whether the expiry date is today or later ```
| where strptime('Expire valid To', "%F") &amp;gt;= relative_time(now(), "@d")&lt;/LI-CODE&gt;&lt;P&gt;The last line is what you will need. Depending on your date format, change the strptime format variable (currently %F is YYYY-MM-DD).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2023 06:03:10 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-02-20T06:03:10Z</dc:date>
    <item>
      <title>How to get data by comparing with a date field and current date?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631508#M51790</link>
      <description>&lt;P&gt;We have different licenses expires by different dates .The current sourcetype data comprises of both future expiry and past expiry too.&lt;/P&gt;
&lt;P&gt;we don’t want license that are expired meaning anything that is before the current day.&lt;/P&gt;
&lt;P&gt;"Expire valid To" field will have this date .&lt;/P&gt;
&lt;P&gt;Please let me know how to achieve this in SPL .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 15:04:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631508#M51790</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2023-02-21T15:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by comparing with a date field and current date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631509#M51791</link>
      <description>&lt;P class="lia-align-left"&gt;Here's a simple example that generates 20 dates within one year before or after today and makes that date YYYY-MM-DD.&lt;/P&gt;&lt;P class="lia-align-left"&gt;The where clause simply checks that date is &amp;gt;= today&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=20
``` Make up a random sample of expiry dates within 1 uyear before and after today ```
| eval r=365
| eval range=random() % (r * 2 * 86400) 
| eval "Expire valid To"=strftime(now() + (r * 86400) - range, "%F")
``` Now simply test whether the expiry date is today or later ```
| where strptime('Expire valid To', "%F") &amp;gt;= relative_time(now(), "@d")&lt;/LI-CODE&gt;&lt;P&gt;The last line is what you will need. Depending on your date format, change the strptime format variable (currently %F is YYYY-MM-DD).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 06:03:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631509#M51791</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-20T06:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data by comparing with a date field and current date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631541#M51792</link>
      <description>&lt;P&gt;It works bowesmana .Thank you .&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 09:41:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-data-by-comparing-with-a-date-field-and-current-date/m-p/631541#M51792</guid>
      <dc:creator>dtccsundar</dc:creator>
      <dc:date>2023-02-20T09:41:01Z</dc:date>
    </item>
  </channel>
</rss>

