<?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 Format of apiStartTime to Epoch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248063#M74002</link>
    <description>&lt;P&gt;Hi, thank you for coming back to me with this and for the clarification on my query.&lt;/P&gt;

&lt;P&gt;The problem is, is that in isolation this line &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|eval startTime=strptime(apiStartTime, "%a %m %d %H:%M:%S %Y")&lt;/CODE&gt; isn't converting the api time to epoch.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2016 12:01:34 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2016-03-15T12:01:34Z</dc:date>
    <item>
      <title>Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248061#M74000</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm trying to change the "apiStartTime" which is in the following format 'Sat Mar 5 00:00:00 2016' including the apostrophes to an epoch time so I can perform some date calculations.&lt;/P&gt;

&lt;P&gt;So I've been looking at the Splunk documentation &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.2/SearchReference/Commontimeformatvariables"&gt;here&lt;/A&gt; and I thought I'd understood the variables I need to use and then convert and I put together the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval startTime=strptime(apiStartTime, "%a %m %d %H:%M:%S %Y")|convert timeformat="%d/%b/%Y" ctime(startTime)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Unfortunately though this isn't working, and I'm not sure why.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone could possibly look at this please and let me know where I've gone wrong.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 07:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248061#M74000</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-15T07:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248062#M74001</link>
      <description>&lt;P&gt;The first half of your SPL correctly converts an apiStartTime string into epoch form.  The second half converts the epoch back into a string, which may not be necessary, depending on why you need an epoch.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 11:50:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248062#M74001</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-03-15T11:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248063#M74002</link>
      <description>&lt;P&gt;Hi, thank you for coming back to me with this and for the clarification on my query.&lt;/P&gt;

&lt;P&gt;The problem is, is that in isolation this line &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|eval startTime=strptime(apiStartTime, "%a %m %d %H:%M:%S %Y")&lt;/CODE&gt; isn't converting the api time to epoch.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 12:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248063#M74002</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-15T12:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248064#M74003</link>
      <description>&lt;P&gt;If apiStartTime truly includes apostrophes, then the format string should be &lt;CODE&gt;"'%a %m %d %H:%M:%S %Y'"&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 12:08:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248064#M74003</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-03-15T12:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248065#M74004</link>
      <description>&lt;P&gt;Hi, thank you for this. I just had to make a minor change to "'%a %m %b %H:%M:%S %Y'", which now works great.&lt;/P&gt;

&lt;P&gt;In my initial testing I had incorporated a ' but with a % beforehand, because in the documentation it suggested to use something as a literal character add a % beforehand. I obviously misinterpreted this.&lt;/P&gt;

&lt;P&gt;Once again thank you for your help and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 12:19:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248065#M74004</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-15T12:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248066#M74005</link>
      <description>&lt;P&gt;In &lt;CODE&gt;strptime&lt;/CODE&gt; and &lt;CODE&gt;strftime&lt;/CODE&gt; format strings, all characters are literal except those preceded by '%'.  Use "%%" to get a literal '%'.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 12:26:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248066#M74005</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-03-15T12:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248067#M74006</link>
      <description>&lt;P&gt;Ahh I see.&lt;/P&gt;

&lt;P&gt;That's a lot clearer now. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 12:29:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248067#M74006</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-03-15T12:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Format of apiStartTime to Epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248068#M74007</link>
      <description>&lt;P&gt;This is reviving a very old thread, but I will still post this in case someone else needs it. Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval startTime=strptime('apiStartTime', "'%a %b %e %H:%M:%S %Y'")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 05:44:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Format-of-apiStartTime-to-Epoch/m-p/248068#M74007</guid>
      <dc:creator>nvanderwalt_spl</dc:creator>
      <dc:date>2018-03-26T05:44:58Z</dc:date>
    </item>
  </channel>
</rss>

