<?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 Issue in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561099#M92699</link>
    <description>&lt;P&gt;It looks like you are getting a 4 digit year, so it'd be more like this -&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval x="8/04/2016 9:40:41 PM"&lt;BR /&gt;| eval y=strptime(x, "%m/%d/%Y %I:%M:%S %p")&lt;BR /&gt;| eval z=strftime(y, "%m/%d/%Y")&lt;BR /&gt;| table x y z&lt;/P&gt;&lt;P&gt;Lowercase y is for 2 digit years, capital Y is for 4 digit years&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 20:41:42 GMT</pubDate>
    <dc:creator>TheDeFoor</dc:creator>
    <dc:date>2021-07-27T20:41:42Z</dc:date>
    <item>
      <title>Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561086#M92693</link>
      <description>&lt;P&gt;I have gone through the forums looking for an answer to this, but nothing has worked.&amp;nbsp; I am trying to convert a string to a date.&amp;nbsp; I have data in an index that is extracted, with a field named Expiration_Date that contains a string that is actually a date/time, such as 5/22/2022 10:10:25 PM.&lt;/P&gt;&lt;P&gt;I found that this query works properly:&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval x="08/04/16 9:40:41 PM"&lt;BR /&gt;| eval y=strptime(x, "%m/%d/%y %H:%M:%S")&lt;BR /&gt;| eval z=strftime(y, "%m/%d/%Y")&lt;BR /&gt;| table x y z&lt;/P&gt;&lt;P&gt;This query outputs the converted time properly in the z field.&amp;nbsp; However, when I try to use this with my data, as such&lt;/P&gt;&lt;P&gt;index = ssl_certs&lt;BR /&gt;| eval x=Expiration_Date&lt;BR /&gt;| eval y=strptime(x, "%m/%d/%y %H:%M:%S")&lt;BR /&gt;| eval z=strftime(y, "%m/%d/%Y")&lt;BR /&gt;| table Expiration_Date, x, y, z&lt;/P&gt;&lt;P&gt;The x field is equal to the Expiration_Date field, but y and z fields are empty.&amp;nbsp; Is there something special I am missing here with loading in the values of the Expiration_Date field into the eval statements?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561086#M92693</guid>
      <dc:creator>matthewfry57</dc:creator>
      <dc:date>2021-07-27T20:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561090#M92694</link>
      <description>Hi&lt;BR /&gt;Can you try to use %I and %p as you are using 12h not 24h time?&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;BR /&gt;r. Ismo</description>
      <pubDate>Tue, 27 Jul 2021 20:28:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561090#M92694</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-07-27T20:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561092#M92695</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;What is the data you're getting for Expiration_Date? It looks like you are expecting MM/DD/YY HH:MM:SS or 07/27/21 01:29:33. Is this the format of the Expiration_Date field? Can you provide an example?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561092#M92695</guid>
      <dc:creator>TheDeFoor</dc:creator>
      <dc:date>2021-07-27T20:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561095#M92696</link>
      <description>&lt;P&gt;Expiration_Date values look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matthewfry57_0-1627418039417.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15282i877A805082C2578B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matthewfry57_0-1627418039417.png" alt="matthewfry57_0-1627418039417.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561095#M92696</guid>
      <dc:creator>matthewfry57</dc:creator>
      <dc:date>2021-07-27T20:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561097#M92697</link>
      <description>&lt;P&gt;I had tried this also, same result.&lt;/P&gt;&lt;P&gt;index = ssl_certs&lt;BR /&gt;| eval x=Expiration_Date&lt;BR /&gt;| eval y=strptime(x, "%m/%d/%y %I:%M:%S %p")&lt;BR /&gt;| eval z=strftime(y, "%m/%d/%Y")&lt;BR /&gt;| table Expiration_Date, x, y, z&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matthewfry57_0-1627418134736.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15283i78B7D22EDD5010CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matthewfry57_0-1627418134736.png" alt="matthewfry57_0-1627418134736.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561097#M92697</guid>
      <dc:creator>matthewfry57</dc:creator>
      <dc:date>2021-07-27T20:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561098#M92698</link>
      <description>You are sure that Expiration_Date is not a multivalue field or it’s not containing any additional characters?</description>
      <pubDate>Tue, 27 Jul 2021 20:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561098#M92698</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-07-27T20:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561099#M92699</link>
      <description>&lt;P&gt;It looks like you are getting a 4 digit year, so it'd be more like this -&lt;/P&gt;&lt;P&gt;| makeresults&lt;BR /&gt;| eval x="8/04/2016 9:40:41 PM"&lt;BR /&gt;| eval y=strptime(x, "%m/%d/%Y %I:%M:%S %p")&lt;BR /&gt;| eval z=strftime(y, "%m/%d/%Y")&lt;BR /&gt;| table x y z&lt;/P&gt;&lt;P&gt;Lowercase y is for 2 digit years, capital Y is for 4 digit years&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561099#M92699</guid>
      <dc:creator>TheDeFoor</dc:creator>
      <dc:date>2021-07-27T20:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561104#M92700</link>
      <description>&lt;P&gt;Yup I am sure, here is an example of the extracted field.&amp;nbsp; No extra spaces or anything.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matthewfry57_0-1627418994175.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15284i2DADBC672B2EC02C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matthewfry57_0-1627418994175.png" alt="matthewfry57_0-1627418994175.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The source data comes from a file that looks like this (obfuscated hostnames):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="matthewfry57_1-1627419094233.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15285iE84F71C9C477D6D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="matthewfry57_1-1627419094233.png" alt="matthewfry57_1-1627419094233.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:52:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561104#M92700</guid>
      <dc:creator>matthewfry57</dc:creator>
      <dc:date>2021-07-27T20:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert String to Date Issue</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561105#M92701</link>
      <description>&lt;P&gt;That was my problem!!&amp;nbsp; Thank you much!!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 20:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Convert-String-to-Date-Issue/m-p/561105#M92701</guid>
      <dc:creator>matthewfry57</dc:creator>
      <dc:date>2021-07-27T20:53:07Z</dc:date>
    </item>
  </channel>
</rss>

