<?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: Convert String to Date then display Latest Date in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299040#M56554</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* 
| fields "SCCM Last Policy Request"
| eval SCCM_Last_Policy_Request = strptime("SCCM Last Policy Request", "%m/%d/%Y %H:%M")
| sort 1 - SCCM_Last_Policy_Request
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 May 2017 18:26:23 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-05-17T18:26:23Z</dc:date>
    <item>
      <title>Convert String to Date then display Latest Date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299038#M56552</link>
      <description>&lt;P&gt;I have this search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* |fields "SCCM Last Policy Request"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives me results like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SCCM Last Policy Request
3/28/2017 19:25
3/13/2017 15:51
3/13/2017 16:31
3/21/2017 13:59
3/19/2017 0:02
1/10/2017 18:01
4/3/2017 13:21
3/24/2017 15:47
3/2/2017 6:35
3/17/2017 23:52
3/28/2017 15:00
3/20/2017 20:48
3/27/2017 13:47
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want my search to convert all of the dates into actual dates (MM/DD/YYYY) then to grab the latest date and only display that date/time.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2017 16:28:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299038#M56552</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-05-17T16:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date then display Latest Date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299039#M56553</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* |fields "SCCM Last Policy Request" | eval Date=strptime(mvindex(split('SCCM Last Policy Request'," "),0),"%m/%d/%Y") | eventstats max(Date) as max | where Date=max
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you records with max/latest date value. If there are multiple records in that date it'll show all those. &lt;/P&gt;

&lt;P&gt;If you're looking for just single latest records, considering both date and time, try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* |fields "SCCM Last Policy Request" | eval Date=strptime('SCCM Last Policy Request',"%m/%d/%Y %H:%M") | sort 1 -Date | fields "SCCM Last Policy Request" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* |fields "SCCM Last Policy Request" | eval Date=strptime('SCCM Last Policy Request',"%m/%d/%Y %H:%M") | stats max(Date) as "SCCM Last Policy Request" | eval "SCCM Last Policy Request"=strftime('SCCM Last Policy Request',"%m/%d/%Y %H:%M")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 May 2017 16:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299039#M56553</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-05-17T16:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date then display Latest Date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299040#M56554</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup fdss2017.csv|search "SCCM Last Policy Request"=* 
| fields "SCCM Last Policy Request"
| eval SCCM_Last_Policy_Request = strptime("SCCM Last Policy Request", "%m/%d/%Y %H:%M")
| sort 1 - SCCM_Last_Policy_Request
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 May 2017 18:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-then-display-Latest-Date/m-p/299040#M56554</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-17T18:26:23Z</dc:date>
    </item>
  </channel>
</rss>

