<?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 remove time value (null) from string value that includes date and time value in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484616#M82986</link>
    <description>&lt;P&gt;Hello all,  I am trying to remove the time portion of the string value of a field that resides in our indexed data. The expiration field contains a string value as shown below as a date and time.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="db" unique_id="00-201" expiration="*"
| eval mytime=strftime(strptime(expiration, "%m/%d/%Y"),"%m/%d/%Y") 
| table unique_id expiration | dedup unique_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Results:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;unique_id        expiration
00-201               2022-08-12 00:00:00.0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Goal:  Perform a query to display expiration field value as 06-04-2022 and sort from oldest to newest&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8778i4A5AE5CCE9701922/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 15:55:20 GMT</pubDate>
    <dc:creator>jsnyderlmco</dc:creator>
    <dc:date>2020-04-29T15:55:20Z</dc:date>
    <item>
      <title>How to remove time value (null) from string value that includes date and time value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484616#M82986</link>
      <description>&lt;P&gt;Hello all,  I am trying to remove the time portion of the string value of a field that resides in our indexed data. The expiration field contains a string value as shown below as a date and time.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Query:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="db" unique_id="00-201" expiration="*"
| eval mytime=strftime(strptime(expiration, "%m/%d/%Y"),"%m/%d/%Y") 
| table unique_id expiration | dedup unique_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Results:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;unique_id        expiration
00-201               2022-08-12 00:00:00.0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Goal:  Perform a query to display expiration field value as 06-04-2022 and sort from oldest to newest&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8778i4A5AE5CCE9701922/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 15:55:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484616#M82986</guid>
      <dc:creator>jsnyderlmco</dc:creator>
      <dc:date>2020-04-29T15:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove time value (null) from string value that includes date and time value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484617#M82987</link>
      <description>&lt;P&gt;It's not clear if you want to remove the timestamp from the event or just sort events by a timestamp that's not _time.  I'll assume the latter.&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="db" unique_id="00-201" expiration="*"
| dedup unique_id
| eval sortTime= strptime(expiration, "%m/%d/%Y")
| sort + sortTime
| eval expTime = strftime(sortTime, "%m-%d-%Y")
| table unique_id expTime
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 17:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484617#M82987</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-29T17:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove time value (null) from string value that includes date and time value</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484618#M82988</link>
      <description>&lt;P&gt;Thank you for the quick response.  It worked perfectly.  One of the challenges we were experiencing was the inability to sort the expiration date as a date field.  I appreciate the assist.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 21:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-remove-time-value-null-from-string-value-that-includes/m-p/484618#M82988</guid>
      <dc:creator>jsnyderlmco</dc:creator>
      <dc:date>2020-04-29T21:22:46Z</dc:date>
    </item>
  </channel>
</rss>

