<?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 do I convert these timestamps to epoch? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238873#M46397</link>
    <description>&lt;P&gt;See the answer posted here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html"&gt;https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I tweaked the code sample from the above post to match the date format example you provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_base_search |
| eval branchExecutionStartTime="Wed Jul 06 09:21:22 CDT 2016"
| eval branchExecutionEndTime="Wed Jul 06 09:21:22 CDT 2016"
| eval it = strptime(branchExecutionStartTime, "%a %b %e %H:%M:%S %Z %Y") 
| eval ot = strptime(branchExecutionEndTime, "%a %b %e %H:%M:%S %Z %Y") 
| eval diff = tostring((ot - it), "duration") 
| table in_time, out_time, diff 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For reference, below are the various date/time format variables Splunk uses:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2016 18:41:03 GMT</pubDate>
    <dc:creator>kbarker302</dc:creator>
    <dc:date>2016-07-06T18:41:03Z</dc:date>
    <item>
      <title>How do I convert these timestamps to epoch?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238872#M46396</link>
      <description>&lt;P&gt;Need help converting these times to epoch so that I can do a DIFF between them.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;branchExecutionStartTime=Wed Jul 06 09:21:22 CDT 2016
branchExecutionEndTime=Wed Jul 06 09:21:22 CDT 2016
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone help?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 18:25:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238872#M46396</guid>
      <dc:creator>kmccowen</dc:creator>
      <dc:date>2016-07-06T18:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert these timestamps to epoch?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238873#M46397</link>
      <description>&lt;P&gt;See the answer posted here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html"&gt;https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I tweaked the code sample from the above post to match the date format example you provided:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_base_search |
| eval branchExecutionStartTime="Wed Jul 06 09:21:22 CDT 2016"
| eval branchExecutionEndTime="Wed Jul 06 09:21:22 CDT 2016"
| eval it = strptime(branchExecutionStartTime, "%a %b %e %H:%M:%S %Z %Y") 
| eval ot = strptime(branchExecutionEndTime, "%a %b %e %H:%M:%S %Z %Y") 
| eval diff = tostring((ot - it), "duration") 
| table in_time, out_time, diff 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For reference, below are the various date/time format variables Splunk uses:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 18:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238873#M46397</guid>
      <dc:creator>kbarker302</dc:creator>
      <dc:date>2016-07-06T18:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert these timestamps to epoch?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238874#M46398</link>
      <description>&lt;P&gt;Have you looked at convert OR eva-strptime commands? Are the timestamp field already extracted?&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/convert&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions#Date_and_Time_functions"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions#Date_and_Time_functions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2016 18:41:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-convert-these-timestamps-to-epoch/m-p/238874#M46398</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-06T18:41:24Z</dc:date>
    </item>
  </channel>
</rss>

