<?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 a timestamp from one timezone to another (inline) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510476#M142871</link>
    <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2020-07-22T12:59:12.301063Z"
| eval UTC=strptime(_raw."+0000","%FT%T.%6QZ%z")
| eval EST=ceil(relative_time(UTC,"-4h")).".".mvindex(split(UTC,"."),1)
| convert ctime(UTC) ctime(EST)&lt;/LI-CODE&gt;&lt;P&gt;how about this? It isn't very easy, I guess.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 14:57:51 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-07-22T14:57:51Z</dc:date>
    <item>
      <title>How do I convert a timestamp from one timezone to another (inline)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510468#M142865</link>
      <description>&lt;P&gt;I have an issue where logs contain timestamps in zulu and the server uses local time for its index.&amp;nbsp; I need to calculate delays now since the logs are initially written on vendor servers and there can be between 0 delay or over an hour behind.&lt;/P&gt;
&lt;P&gt;I can't find any functions that do this and am not having luck either converting a timestamp from one timezone to another or converting timezones to seconds to do any math on.&lt;/P&gt;
&lt;P&gt;timestamp log was written&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;2020-07-22T12:59:12.301063Z&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;timezone log was indexed from _time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;-0400&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not an admin and have no control or influence over the servers or its configuration.&lt;/P&gt;
&lt;P&gt;Is there an easy way to do this inline in the query?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 04:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510468#M142865</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2020-07-23T04:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510473#M142869</link>
      <description>&lt;P&gt;Splunk does not have a function for converting time zones.&amp;nbsp; Go to &lt;A href="https://ideas.splunk.com" target="_blank"&gt;https://ideas.splunk.com&lt;/A&gt;&amp;nbsp;to suggest one or to up-vote someone else's idea.&lt;/P&gt;&lt;P&gt;Splunk stores times in UTC and then renders them in the user's selected zone.&amp;nbsp; I suggest you change your Splunk preferences to display time in UTC so you see the true time of the event.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 14:47:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510473#M142869</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-22T14:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510476#M142871</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2020-07-22T12:59:12.301063Z"
| eval UTC=strptime(_raw."+0000","%FT%T.%6QZ%z")
| eval EST=ceil(relative_time(UTC,"-4h")).".".mvindex(split(UTC,"."),1)
| convert ctime(UTC) ctime(EST)&lt;/LI-CODE&gt;&lt;P&gt;how about this? It isn't very easy, I guess.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 14:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510476#M142871</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-22T14:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510479#M142872</link>
      <description>&lt;P&gt;The problem with this is that the offset is hardcoded.&amp;nbsp; I cannot determine the time zone of the server as it changes and I need some SPL that is aware of the server's timezone.&lt;/P&gt;&lt;P&gt;This may be enough though.&amp;nbsp; It looks like I need a table of timezone offsets and its relative time equivalent (e.g. -4h) then i can extract the timezone from _time and look it up in the table to get the relative time equivalent.&lt;/P&gt;&lt;P&gt;It's unfortunate that it's this hard.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:18:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510479#M142872</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2020-07-22T15:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510535#M142884</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2020-07-22T12:59:12.301063Z"
| eval UTC=strptime(_raw."+0000","%FT%T.%6QZ%z")
| eval my_local_TZ=mvindex(split(strftime(UTC,"%FT%T %:::z")," "),1)
| eval my_local_time=ceil(relative_time(UTC,my_local_TZ."h")).".".mvindex(split(UTC,"."),1)
| convert ctime(UTC) ctime(my_local_time)&lt;/LI-CODE&gt;&lt;P&gt;you don't need hard coded.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 20:24:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510535#M142884</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-22T20:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510734#M142964</link>
      <description>&lt;P&gt;This is an improvement.&amp;nbsp; For some reason though it doubles the offset.&amp;nbsp; i am at -4h, but&amp;nbsp;2020-07-22T12:59:12.301063Z is reduced by 8 to become&amp;nbsp;&lt;SPAN&gt;07/22/2020 04:59:12.301063.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I think Splunk strptime() is converting the timezone.&amp;nbsp; It uses the timezone of the logged in user instead of the server local time.&amp;nbsp; It'll only work if i am in the same timezone as the server, which is fine for me but not usually the case with others, and then the rest of the lines re-apply the timezone to double it.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 21:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510734#M142964</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2020-07-23T21:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510752#M142976</link>
      <description>&lt;P&gt;&lt;STRONG&gt;_time&amp;nbsp;&lt;/STRONG&gt;is epoch time. default&amp;nbsp; is UTC. when it displays, it changes user preference time zone.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://en.wikipedia.org/wiki/Unix_time" target="_blank"&gt;https://en.wikipedia.org/wiki/Unix_time&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;if index setting is good, time displays appropriate time zone. it is no problem.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 23:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510752#M142976</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-23T23:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510858#M143056</link>
      <description>&lt;P&gt;What I'm saying is the offset is doubled with your SPL.&amp;nbsp; I don't think Splunk will let you use strptime or strftime in a solution because it uses your local time which can't be a factor.&amp;nbsp; I am only trying to work with vendor time and splunk server local time.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 15:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510858#M143056</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2020-07-24T15:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510876#M143067</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="2020-07-22T12:59:12.301063Z"
| fields - _time
| eval epoch=strptime(_raw."+0000","%FT%T.%6QZ%z")
| eval my_local_TZ=mvindex(split(strftime(epoch,"%FT%T %:::z")," "),1)
| eval my_local_time=ceil(epoch).".".mvindex(split(epoch,"."),1)
| eval time_args = if( -1 * my_local_TZ &amp;gt;= 0, "+".substr(my_local_TZ,2,3), printf("%03d",-1 * my_local_TZ))
| eval UTC = ceil(relative_time(epoch,time_args."h")).".".mvindex(split(epoch,"."),1)
| convert ctime(UTC) ctime(my_local_time)&lt;/LI-CODE&gt;&lt;P&gt;I'm sorry. I've some mistake. I fixed it.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 18:34:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/510876#M143067</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-24T18:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/511417#M143357</link>
      <description>&lt;P&gt;I tested this out in multiple timezones and it produces the correct and same answer.&lt;/P&gt;&lt;P&gt;it's odd how it takes all this, but it works.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 20:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/511417#M143357</guid>
      <dc:creator>weidertc</dc:creator>
      <dc:date>2020-07-28T20:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514515#M144405</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp; thank you for this but I do have a question as I am still fairly new to Splunk.&amp;nbsp; How can I have the corrected time not show the microseconds?&lt;/P&gt;&lt;P&gt;I have this:&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;08/17/2020 10:18:43.071000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and I need this:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;08/17/2020 10:18:43&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 18:35:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514515#M144405</guid>
      <dc:creator>senior_splunk</dc:creator>
      <dc:date>2020-08-17T18:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514559#M144427</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/178068"&gt;@senior_splunk&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I can't tell you anything about the time without knowing the details.&lt;/P&gt;&lt;P&gt;First, please clarify whether you are talking about logs, display or field processing.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 22:31:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514559#M144427</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-17T22:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514561#M144429</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt;&amp;nbsp; apologies, I should have been more clear.&amp;nbsp; The output of your code produces time that is adjusted correctly but includes microseconds in the output.&amp;nbsp; I was simply looking for a way to produce the output without them.&lt;/P&gt;&lt;P&gt;A co-worker who is much better with splunk than I am gave me the following which does the trick&lt;/P&gt;&lt;P&gt;rex field=my_local_time mode=sed "s/\..*$//"&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 22:34:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514561#M144429</guid>
      <dc:creator>senior_splunk</dc:creator>
      <dc:date>2020-08-17T22:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I convert a timestamp from one timezone to another (inline)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514562#M144430</link>
      <description>&lt;P&gt;&lt;STRONG&gt;| eval my_local_time=ceil(epoch).".".mvindex(split(epoch,"."),1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;My query is deliberately adding microseconds here.&lt;BR /&gt;&lt;BR /&gt;just simply:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;| eval my_local_time=ceil(epoch)&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/178068"&gt;@senior_splunk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 22:41:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-convert-a-timestamp-from-one-timezone-to-another-inline/m-p/514562#M144430</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-17T22:41:39Z</dc:date>
    </item>
  </channel>
</rss>

