<?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 Zulu time to epoch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77699#M19628</link>
    <description>&lt;P&gt;This solution doesn't appear to account for timezone, which Splunk automatically adjusts for. By adding a % before the Z, Splunk will not perform this adjustment, which unless you have your timezone set as GMT you dont want (this assumes its ACTUALLY zulu time).&lt;/P&gt;

&lt;P&gt;Assuming you dont need to do the hyphen replacement, you can also shorthand the format to "%FT%T.%5N%Z"&lt;/P&gt;

&lt;P&gt;The solution thus becomes:&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%FT%T.%5N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;or&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%Y-%m-%dT%H:%M:%S.%9N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 21:08:16 GMT</pubDate>
    <dc:creator>Aether</dc:creator>
    <dc:date>2016-02-25T21:08:16Z</dc:date>
    <item>
      <title>Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77695#M19624</link>
      <description>&lt;P&gt;Some Windows events report date/time in zulu format: “‎2013‎-‎03‎-‎27T21:00:32.950000000Z”. I want to convert to epoch. Tried “&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;eval pt1=strptime(Previous_Time,"%Y-%m-%dT%H:%M:%S.%9NZ")&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;and some variants. Unfortunately no result. I am obviously overlooking something. Who knows what?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 12:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77695#M19624</guid>
      <dc:creator>landzaat</dc:creator>
      <dc:date>2013-03-28T12:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77696#M19625</link>
      <description>&lt;P&gt;This works for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%Y-%m-%dT%H:%M:%S.%9NZ")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...but only if I type the date in myself. If I copy your date string it fails because the dashes in your date string aren't dashes. Using your copied date string, I need to do this to make it work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval time = strptime(replace("2013‎-‎03‎-‎27T21:00:32.950000000Z", "\D", ""), "%Y%m%d%H%M%S%9N")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Mar 2013 12:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77696#M19625</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-28T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77697#M19626</link>
      <description>&lt;P&gt;Thanks. Never thought strings could be not what they look like. Valuable hint for all coming troubleshoots.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 13:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77697#M19626</guid>
      <dc:creator>landzaat</dc:creator>
      <dc:date>2013-03-28T13:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77698#M19627</link>
      <description>&lt;P&gt;I've copied your string into my Notepad++ and it comes out as ?-? for the dashes when trying to interpret them as ANSI, gibberish when trying to interpret them as UTF-8&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 13:42:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77698#M19627</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2013-03-28T13:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77699#M19628</link>
      <description>&lt;P&gt;This solution doesn't appear to account for timezone, which Splunk automatically adjusts for. By adding a % before the Z, Splunk will not perform this adjustment, which unless you have your timezone set as GMT you dont want (this assumes its ACTUALLY zulu time).&lt;/P&gt;

&lt;P&gt;Assuming you dont need to do the hyphen replacement, you can also shorthand the format to "%FT%T.%5N%Z"&lt;/P&gt;

&lt;P&gt;The solution thus becomes:&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%FT%T.%5N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;or&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%Y-%m-%dT%H:%M:%S.%9N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 21:08:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77699#M19628</guid>
      <dc:creator>Aether</dc:creator>
      <dc:date>2016-02-25T21:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Zulu time to epoch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77700#M19629</link>
      <description>&lt;P&gt;This solution doesn't appear to account for timezone, which Splunk automatically adjusts for. By adding a % before the Z, Splunk will not perform this adjustment, which unless you have your timezone set as GMT you dont want (this assumes its ACTUALLY zulu time).&lt;/P&gt;

&lt;P&gt;Assuming you dont need to do the hyphen replacement, you can also shorthand the format to "%FT%T.%5N%Z"&lt;/P&gt;

&lt;P&gt;The solution thus becomes:&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%FT%T.%5N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;or&lt;BR /&gt;
&lt;CODE&gt;eval time = strptime("2013-03-27T21:00:32.950000000Z", "%Y-%m-%dT%H:%M:%S.%9N%Z")&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 21:10:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-Zulu-time-to-epoch/m-p/77700#M19629</guid>
      <dc:creator>Aether</dc:creator>
      <dc:date>2016-02-25T21:10:39Z</dc:date>
    </item>
  </channel>
</rss>

