<?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: Why does my search only give strptime output for one of three time values? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207847#M60585</link>
    <description>&lt;P&gt;Does this happen when you open the CSV in excel, or was the CSV saved from excel? Sometimes it does some weird auto-formatting stuff on dates ...&lt;BR /&gt;
Do you just want to reformat it as YYYY-MM-DD?&lt;BR /&gt;
If so, you could try just using the replace command instead of fieldformat:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| replace "* 00:00:00.0" with "*" in DATE_OF_BIRTH
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Nov 2016 22:11:24 GMT</pubDate>
    <dc:creator>lquinn</dc:creator>
    <dc:date>2016-11-03T22:11:24Z</dc:date>
    <item>
      <title>Why does my search only give strptime output for one of three time values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207844#M60582</link>
      <description>&lt;P&gt;I have a field DATE_OF_BIRTH and the values are like &lt;BR /&gt;
1962-09-30 00:00:00.0&lt;BR /&gt;&lt;BR /&gt;
1955-10-21 00:00:00.0&lt;BR /&gt;&lt;BR /&gt;
1988-10-31 00:00:00.0&lt;/P&gt;

&lt;P&gt;I am firing the below query,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=aimsprod source=accident splunk_server=alpputl018 *100172697* OR *100172679* | fieldformat dobtime=strptime(DATE_OF_BIRTH,"%Y-%m-%d %H:%M:%S")  |  table DATE_OF_BIRTH,dobtime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;STRONG&gt;dobtime&lt;/STRONG&gt; field only gives output for the value 1988-10-31 00:00:00.0.&lt;/P&gt;

&lt;P&gt;Why it does not give output for the other 2 above mentioned values?&lt;IMG src="https://community.splunk.com/storage/temp/170221-untitled.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207844#M60582</guid>
      <dc:creator>ppanchal</dc:creator>
      <dc:date>2020-09-29T11:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my search only give strptime output for one of three time values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207845#M60583</link>
      <description>&lt;P&gt;I believe it will be because epoch time is calculated as the number of seconds since 1st Jan 1970. The two dates that are not being converted occur before this time, so the value would be negative, which is not supported by Splunk. What are you trying to achieve by converting the timestamps to epoch?&lt;/P&gt;

&lt;P&gt;Might be worth taking a look at this answer:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/214742/can-splunk-strptime-work-with-the-date-before-1970-1.html"&gt;https://answers.splunk.com/answers/214742/can-splunk-strptime-work-with-the-date-before-1970-1.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 21:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207845#M60583</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-11-02T21:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my search only give strptime output for one of three time values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207846#M60584</link>
      <description>&lt;P&gt;The issue that I am actually facing is when I export the data to a csv file, the date/time format is changed to something like 00:00:00...&lt;BR /&gt;
Is there a way I an fix this?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 13:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207846#M60584</guid>
      <dc:creator>ppanchal</dc:creator>
      <dc:date>2016-11-03T13:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why does my search only give strptime output for one of three time values?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207847#M60585</link>
      <description>&lt;P&gt;Does this happen when you open the CSV in excel, or was the CSV saved from excel? Sometimes it does some weird auto-formatting stuff on dates ...&lt;BR /&gt;
Do you just want to reformat it as YYYY-MM-DD?&lt;BR /&gt;
If so, you could try just using the replace command instead of fieldformat:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| replace "* 00:00:00.0" with "*" in DATE_OF_BIRTH
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 22:11:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-my-search-only-give-strptime-output-for-one-of-three/m-p/207847#M60585</guid>
      <dc:creator>lquinn</dc:creator>
      <dc:date>2016-11-03T22:11:24Z</dc:date>
    </item>
  </channel>
</rss>

