<?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 a string in ISO 8601 to local time zone (accounting for DST) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486747#M193727</link>
    <description>&lt;P&gt;What do you mean "sample"? User preference isn't the issue -- I'm using the date to look up something in a lookup table.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 13:00:21 GMT</pubDate>
    <dc:creator>jkotula</dc:creator>
    <dc:date>2020-01-14T13:00:21Z</dc:date>
    <item>
      <title>Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486744#M193724</link>
      <description>&lt;P&gt;I have a string from a complex JSON event providing an ISO 8601 date/time in UTC. I want to convert it to the local time zone, in this case CST or CDT. The computer knows its timezone and keeps its clock adjusted, so the timezone info is in there somewhere. After hours of search I can find no way that Splunk can perform this simple operation. strptime() gets me half way there, but there is no general, portable way to do the appropriate timezone adjustment.&lt;/P&gt;

&lt;P&gt;This has nothing to do with the event timestamps! The timestamps I'm converting are different from those. All I'm looking for is simple date/time processing supported by virtually every programming language in existence...&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 20:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486744#M193724</guid>
      <dc:creator>jkotula</dc:creator>
      <dc:date>2020-01-13T20:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486745#M193725</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/DateandTimeFunctions"&gt;DateandTimeFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;what's your sample?&lt;/P&gt;

&lt;P&gt;user preference time zone is local?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2020 21:29:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486745#M193725</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-13T21:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486746#M193726</link>
      <description>&lt;P&gt;I admit time zones are not my strong suit, but does this get you closer?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval UTCtime="2020-01-05T13:15:30Z" | fields - _time
| eval epochTime=strptime(UTCtime,"%Y-%m-%dT%H:%M:%S.%Q")
| eval mySecondsOffset=abs(tonumber(strftime(epochTime,"%:::z")))*60*60
| eval localTimestamp=strftime(epochTime-mySecondsOffset,"%Y-%m-%dT%H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jan 2020 21:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486746#M193726</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2020-01-13T21:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486747#M193727</link>
      <description>&lt;P&gt;What do you mean "sample"? User preference isn't the issue -- I'm using the date to look up something in a lookup table.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:00:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486747#M193727</guid>
      <dc:creator>jkotula</dc:creator>
      <dc:date>2020-01-14T13:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486748#M193728</link>
      <description>&lt;P&gt;Not really. The whole problem is that I don't know the offset, particularly with DST.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486748#M193728</guid>
      <dc:creator>jkotula</dc:creator>
      <dc:date>2020-01-14T13:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486749#M193729</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval UTC_string="Mon Jul 13 09:30:00 2017 +0000"
| eval UTC=strptime(UTC_string,"%c %z")
| eval local_time=strftime(UTC,"%+")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi @jkotula &lt;BR /&gt;
There are the references.&lt;BR /&gt;
 &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Commontimeformatvariables"&gt;Common time format variables&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;
 &lt;A href="https://www.timeanddate.com/time/europe/"&gt;Daylight Saving Time and Time Zones in Europe&lt;/A&gt;&lt;BR /&gt;
 &lt;A href="https://answers.splunk.com/answers/737581/does-tz-setting-account-for-daylight-savings-time.html"&gt;does-tz-setting-account-for-daylight-savings-time&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;%z&lt;/CODE&gt; is offset variables.&lt;/P&gt;

&lt;P&gt;Changing UNIX time to a time string will basically be local time.&lt;BR /&gt;
Wouldn't it work if I passed the offset value to &lt;CODE&gt;strptime&lt;/CODE&gt; according to the format, as in my example?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 14:10:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486749#M193729</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-14T14:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486750#M193730</link>
      <description>&lt;P&gt;UTC format doesn't have the offset in all cases. In my case, I'm looking at JSON output generated by the Newtonsoft library in C#.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 14:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486750#M193730</guid>
      <dc:creator>jkotula</dc:creator>
      <dc:date>2020-01-14T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486751#M193731</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval json_time_text="2020-01-05T13:15:30"
| eval time=strptime(json_time_text." +0000","%FT%T %z")
| eval local_time=strftime(time,"%FT%T %z")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Why don't you modify the time string when searching?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 14:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486751#M193731</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-14T14:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a string in ISO 8601 to local time zone (accounting for DST)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486752#M193732</link>
      <description>&lt;P&gt;Because I don't know the timezone offset. That's the whole issue.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 14:40:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Convert-a-string-in-ISO-8601-to-local-time-zone-accounting-for/m-p/486752#M193732</guid>
      <dc:creator>jkotula</dc:creator>
      <dc:date>2020-01-14T14:40:20Z</dc:date>
    </item>
  </channel>
</rss>

