<?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: Formatting String to Time returns nothing in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150067#M42022</link>
    <description>&lt;P&gt;Have you tried including the milliseconds?&lt;BR /&gt;
"TSStart"="2013-10-14T18:35:03.487" | eval MyTime=strptime(TSStart,"%Y-%m-%dT%T.%f")&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2013 17:48:24 GMT</pubDate>
    <dc:creator>lukejadamec</dc:creator>
    <dc:date>2013-11-20T17:48:24Z</dc:date>
    <item>
      <title>Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150066#M42021</link>
      <description>&lt;P&gt;Here is my query:&lt;BR /&gt;
"TSStart"="2013-10-14T18:35:03.487" | eval MyTime=strptime(TSStart,"%Y-%m-%dT%T")&lt;/P&gt;

&lt;P&gt;My Time Format for start time is in the format as above: 2013-10-14T18:35:03.487&lt;BR /&gt;
The goal of this is to show the datetime in a format that is more readable, I want to first attempt to parse it into a timestamp format.&lt;BR /&gt;
This is not the same field I am using for my Timestamp value as there is also a TSEnd within the data that I will need to format.&lt;/P&gt;

&lt;P&gt;My query is not coming back with anything for "MyTime" and not throwing any errors in the logs.&lt;BR /&gt;
Is my date format string incorrect? I have tried several variations and cannot get this to work.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 17:12:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150066#M42021</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2013-11-20T17:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150067#M42022</link>
      <description>&lt;P&gt;Have you tried including the milliseconds?&lt;BR /&gt;
"TSStart"="2013-10-14T18:35:03.487" | eval MyTime=strptime(TSStart,"%Y-%m-%dT%T.%f")&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 17:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150067#M42022</guid>
      <dc:creator>lukejadamec</dc:creator>
      <dc:date>2013-11-20T17:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150068#M42023</link>
      <description>&lt;P&gt;Yeah I've tried &lt;BR /&gt;
strptime(TSStart,"%Y-%m-%dT%T.%3N") and seperating hour, minute, second as well.&lt;BR /&gt;
I just tried the one you have there and it did not work either&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 17:50:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150068#M42023</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2013-11-20T17:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150069#M42024</link>
      <description>&lt;P&gt;That works for me.&lt;/P&gt;

&lt;P&gt;| eval TSStart="2013-10-14T18:35:03.487" | eval MyTime=strptime(TSStart,"%Y-%m-%dT%T") | eval MyTime2=strptime(TSStart,"%Y-%m-%dT%H:%M:%S.%3N") | table TSStart, MyTime, MyTime2&lt;/P&gt;

&lt;P&gt;TSStart     MyTime  MyTime2&lt;BR /&gt;
2013-10-14T18:35:03.487 1381790103.000000   1381790103.487000&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 18:05:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150069#M42024</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2013-11-20T18:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150070#M42025</link>
      <description>&lt;P&gt;I tried your search and its working for me. I see you want to get rid of milliseconds (otherwise the format is same). Can you try following:  "TSStart"="2013-10-14T18:35:03.487" | eval MyTime=strptime(mvindex(split(TSStart,"."),0),"%Y-%m-%dT%T")&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 18:06:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150070#M42025</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-20T18:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150071#M42026</link>
      <description>&lt;P&gt;Ok I believe I have figured out this issue. I am using an XML type of Structure and the fields are auto mapped via the KV_MODE = xml. The Field is Actually Event.TSStart. &lt;BR /&gt;
I did a rename on the field (| rename Event.TSStart as TSStart) and it started working.&lt;/P&gt;

&lt;P&gt;I attempted first to surround Event.TSStart with Quotations, but it litterally put "Event.TSStart" in the formula.&lt;/P&gt;

&lt;P&gt;I am not sure if this is a bug or intended.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 18:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150071#M42026</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2013-11-20T18:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting String to Time returns nothing</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150072#M42027</link>
      <description>&lt;P&gt;Basically if your field has a . in it, the formulas fail, even trim&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2013 19:16:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Formatting-String-to-Time-returns-nothing/m-p/150072#M42027</guid>
      <dc:creator>aelliott</dc:creator>
      <dc:date>2013-11-20T19:16:32Z</dc:date>
    </item>
  </channel>
</rss>

