<?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 convert this string to a date? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259249#M77709</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count
| fields - count
| eval timestamp = "2016-05-20T05:16:02.007+02:00"
| eval timestamp_epoch = strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%3N%z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 20 May 2016 08:58:46 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-05-20T08:58:46Z</dc:date>
    <item>
      <title>How to convert this string to a date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259248#M77708</link>
      <description>&lt;P&gt;I'm trying to convert a string to a date.&lt;/P&gt;

&lt;P&gt;The string looks like &lt;CODE&gt;2016-05-20T05:16:02.007+02:00&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 08:39:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259248#M77708</guid>
      <dc:creator>nicocin</dc:creator>
      <dc:date>2016-05-20T08:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259249#M77709</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count
| fields - count
| eval timestamp = "2016-05-20T05:16:02.007+02:00"
| eval timestamp_epoch = strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%3N%z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 May 2016 08:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259249#M77709</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-05-20T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259250#M77710</link>
      <description>&lt;P&gt;Hmm I get something like this "1463714162.007000"&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 09:06:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259250#M77710</guid>
      <dc:creator>nicocin</dc:creator>
      <dc:date>2016-05-20T09:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259251#M77711</link>
      <description>&lt;P&gt;Yes, that's epoch time and that's what Splunk uses internally to represent dates and times.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.epochconverter.com"&gt;http://www.epochconverter.com&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://en.wikipedia.org/wiki/Unix_time"&gt;https://en.wikipedia.org/wiki/Unix_time&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What were  you planning to do with that timestamp after that?&lt;BR /&gt;
Now that it's in the right format you can use strftime and plenty or other functions to work with it. For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval date = strftime(timestamp_epoch, "%Y-%m-%d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 May 2016 09:18:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259251#M77711</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-05-20T09:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert this string to a date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259252#M77712</link>
      <description>&lt;P&gt;Ahh ok, working great like this.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 09:22:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-this-string-to-a-date/m-p/259252#M77712</guid>
      <dc:creator>nicocin</dc:creator>
      <dc:date>2016-05-20T09:22:29Z</dc:date>
    </item>
  </channel>
</rss>

