<?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: Date time formatting variables not producing result I expected in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666551#M228665</link>
    <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;! That definitely does it. I was sure I had tried this already, but somehow, I seem to have missed that particular format string and was skipping the percent before the Z. Thanks again for replying!&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2023 15:46:53 GMT</pubDate>
    <dc:creator>pgoldweic</dc:creator>
    <dc:date>2023-10-27T15:46:53Z</dc:date>
    <item>
      <title>Date time formatting variables not producing result I expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666443#M228627</link>
      <description>&lt;P&gt;Hi, I have an existing search as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; | eval tempTime=strptime(due_at."-0000","%Y-%m-%d %H:%M:%S.%3N%z")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; | eval dueDateCompact = strftime(tempTime, "%m-%d-%y")&lt;BR /&gt;&lt;BR /&gt;which I have used to successfully convert a string field ('due_at') representing an UTC value (although formatted without the time-zone designation at the end), to an abbreviated notation (month-day-year) displayed in local time. So, for example, if "due_at" has a value of "&lt;SPAN&gt;2023-09-30 04:59:59.000", then the resulting "dueDateCompact" field ends up with "09-29-23" in there, correctly representing&amp;nbsp; "due_at" but in Chicago local time (5 hours behind UTC).&amp;nbsp;&lt;BR /&gt;However, my current requirements are such that "due_at" comes formatted as "2023-09-30T04:59:59.000Z" (iso 8601 proper) instead of the original "2023-09-30 04:59:59.000" (note: only the intermediate T and ending Z are the differences between original and updated formats).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Therefore, I updated the first part of my original search to read:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; | eval tempTime=strptime(due_at,"%Y-%m-%d %H:%M:%S.%3QZ")&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(so I am not appending '-0000' anymore to "due_at", since the 'Z' is present in the format string)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but this is NOT producing the correct local time in 'dueDateCompact' anymore (it produces "09-30-23" instead of "09-29-23").&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a logical explanation for this?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 22:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666443#M228627</guid>
      <dc:creator>pgoldweic</dc:creator>
      <dc:date>2023-10-26T22:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Date time formatting variables not producing result I expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666477#M228639</link>
      <description>&lt;P&gt;The letter Z at the end of&amp;nbsp;&lt;SPAN&gt;2023-09-30T04:59:59.000Z signifies Zulu time. (Zulu equals UTC for practical purposes.) &amp;nbsp;All you need to do is&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;strptime(due_at, "%Y-%m-%d %H:%M:%S.%3N%Z").&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 07:32:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666477#M228639</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-27T07:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Date time formatting variables not producing result I expected</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666551#M228665</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;! That definitely does it. I was sure I had tried this already, but somehow, I seem to have missed that particular format string and was skipping the percent before the Z. Thanks again for replying!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 15:46:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-time-formatting-variables-not-producing-result-I-expected/m-p/666551#M228665</guid>
      <dc:creator>pgoldweic</dc:creator>
      <dc:date>2023-10-27T15:46:53Z</dc:date>
    </item>
  </channel>
</rss>

