<?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 Why are relative_time() and strptime() using different time zones? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386325#M69348</link>
    <description>&lt;P&gt;I ran this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval creationdate = "2018-11-15 20:00:00.000000000"
| eval epoch=relative_time(now(), "@h"), epoch2=strptime(creationdate, "%Y-%m-%d %H:%M:%S.%N")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I ran it at a time when epoch and epoch2 should return the same value. However, epoch and epoch2 are 8 hours off from each other, with epoch being the correct value.&lt;/P&gt;

&lt;P&gt;What can I do to troubleshoot this?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 20:51:25 GMT</pubDate>
    <dc:creator>matstap</dc:creator>
    <dc:date>2018-11-15T20:51:25Z</dc:date>
    <item>
      <title>Why are relative_time() and strptime() using different time zones?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386325#M69348</link>
      <description>&lt;P&gt;I ran this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval creationdate = "2018-11-15 20:00:00.000000000"
| eval epoch=relative_time(now(), "@h"), epoch2=strptime(creationdate, "%Y-%m-%d %H:%M:%S.%N")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I ran it at a time when epoch and epoch2 should return the same value. However, epoch and epoch2 are 8 hours off from each other, with epoch being the correct value.&lt;/P&gt;

&lt;P&gt;What can I do to troubleshoot this?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386325#M69348</guid>
      <dc:creator>matstap</dc:creator>
      <dc:date>2018-11-15T20:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why are relative_time() and strptime() using different time zones?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386326#M69349</link>
      <description>&lt;P&gt;For clarification - what exact version of Splunk are you running this on?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 02:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386326#M69349</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2018-11-16T02:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why are relative_time() and strptime() using different time zones?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386327#M69350</link>
      <description>&lt;P&gt;@rich7177  Version 6.6.3&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 03:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386327#M69350</guid>
      <dc:creator>matstap</dc:creator>
      <dc:date>2018-11-16T03:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why are relative_time() and strptime() using different time zones?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386328#M69351</link>
      <description>&lt;P&gt;I think that's because &lt;CODE&gt;now()&lt;/CODE&gt; returns an epoch timestamp in UTC, while the string you have crafted is probably your local time? Converting that to an epoch value without telling strptime what timezone it should use, results in strptime using the splunk server's timezone to convert that, which probably was different from your personal local timezone?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 08:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386328#M69351</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-11-16T08:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why are relative_time() and strptime() using different time zones?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386329#M69352</link>
      <description>&lt;P&gt;That's what was happening. I appended the correct time zone into the date when inputting into the strptime and it works.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2018 18:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-are-relative-time-and-strptime-using-different-time-zones/m-p/386329#M69352</guid>
      <dc:creator>matstap</dc:creator>
      <dc:date>2018-11-19T18:13:10Z</dc:date>
    </item>
  </channel>
</rss>

