<?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: Converting String to date in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211880#M61973</link>
    <description>&lt;P&gt;Try this&lt;BR /&gt;
To convert to epoch&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval testTime = strptime('message.facets.requestStart', "%m/%d/%Y %H:%M:%S:%N")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To convert to epoch and round to start of the day&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval testTime = relative_time(strptime('message.facets.requestStart', "%m/%d/%Y %H:%M:%S:%N"),"@d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Aug 2016 17:54:07 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-08-04T17:54:07Z</dc:date>
    <item>
      <title>Converting String to date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211878#M61971</link>
      <description>&lt;P&gt;I am trying to convert the string "08/04/16 09:40:41.690" to a date in splunk. I think that I am supposed to use some combination of strptime and strftime but I can't figure it you. I thought that eval testTime = strptime(message.facets.requestStart, "%m/%d/%Y %I:%M:%S:%3Q") would do the trick but that doesn't seem to work.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 14:49:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211878#M61971</guid>
      <dc:creator>SAPrabhakar</dc:creator>
      <dc:date>2016-08-04T14:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Converting String to date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211879#M61972</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval x="08/04/16 09:40:41.690" | eval y=strptime(x, "%m/%d/%y %H:%M:%S") | eval z=strftime(y, "%m/%d/%Y") | table x y z
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2016 17:25:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211879#M61972</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-04T17:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Converting String to date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211880#M61973</link>
      <description>&lt;P&gt;Try this&lt;BR /&gt;
To convert to epoch&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval testTime = strptime('message.facets.requestStart', "%m/%d/%Y %H:%M:%S:%N")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To convert to epoch and round to start of the day&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval testTime = relative_time(strptime('message.facets.requestStart', "%m/%d/%Y %H:%M:%S:%N"),"@d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2016 17:54:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-String-to-date/m-p/211880#M61973</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-04T17:54:07Z</dc:date>
    </item>
  </channel>
</rss>

