<?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: Splunk function or query which will convert event timestamp field  &amp;quot;timestamp&amp;quot; to local timestamp in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-function-or-query-which-will-convert-event-timestamp/m-p/592500#M206221</link>
    <description>&lt;P&gt;The &lt;STRONG&gt;_time&lt;/STRONG&gt; field is stored as a unix timestamp (number of seconds since so-called "epoch") and is rendered in webui according to the timezone defined in user's preferences. There is no way to set another timezone within a search.&lt;/P&gt;&lt;P&gt;If you want to parse another field from the event (which is most likely represented in some string form), you should use strptime() to convert from that string to timestamp and then use fieldformat (preferably) or eval with strftime to convert this timestamp to a string.&lt;/P&gt;&lt;P&gt;And again - splunk always shows the timestamp in user's timezone but can parse and interpret a timezone if it's included in the date string. Otherwise it parses the datetime string as if it was in local time.&lt;/P&gt;&lt;P&gt;For example - if I'm located in CEST, the string "5.04.2022 18:57:00", if I call strptime with proper format string will get interpreted as 18:57 CEST. But if the string says "5.04.2022 18:57:00PDT" and I tell splunk to use the timezone definition, it will get parsed as PDT time even though my local timezone is CEST. But if I call strftime on both timestamps, they will be both rendered in CEST, regardless of what timezone the initial string contained.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 16:59:30 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2022-04-05T16:59:30Z</dc:date>
    <item>
      <title>Splunk function or query which will convert event timestamp field  "timestamp" to local timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-function-or-query-which-will-convert-event-timestamp/m-p/592492#M206218</link>
      <description>&lt;P&gt;Looking splunk function or query to change timestamp of&amp;nbsp; &lt;STRONG&gt;"_time"&lt;/STRONG&gt; field in local timestamp.&lt;/P&gt;&lt;P&gt;when we present statistical table of data with time field then that time field value should converted to local time irrespective of location where query are getting executed.&lt;/P&gt;&lt;P&gt;EX:-&lt;/P&gt;&lt;TABLE width="1053"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64.45px"&gt;time&lt;/TD&gt;&lt;TD width="794px"&gt;Message ID&lt;/TD&gt;&lt;TD width="226.462px"&gt;Sender&lt;/TD&gt;&lt;TD width="215.425px"&gt;Recipient&lt;/TD&gt;&lt;TD width="70.825px"&gt;Subject&lt;/TD&gt;&lt;TD width="105.188px"&gt;MessageSize&lt;/TD&gt;&lt;TD width="139.5px"&gt;AttachmentName&lt;/TD&gt;&lt;TD width="148.962px"&gt;dAttachmentName&lt;/TD&gt;&lt;TD width="94.65px"&gt;FilterAction&lt;/TD&gt;&lt;TD width="129.562px"&gt;FinalRule&lt;/TD&gt;&lt;TD width="69.2px"&gt;TLS Version&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="64.45px"&gt;4/5/22 9:01&lt;/TD&gt;&lt;TD width="794px"&gt;&amp;lt;DM5P102MB0126B6CF54A6B2F44B6F6BF295E49@DM5P102MB0126.NAMP102.PROD.OUTLOOK.COM&amp;gt;&lt;/TD&gt;&lt;TD width="226.462px"&gt;Darren_Collishaw@amat.com&lt;/TD&gt;&lt;TD width="215.425px"&gt;tobycollishaw@hotmail.com&lt;/TD&gt;&lt;TD width="70.825px"&gt;Courses - Youtube&lt;/TD&gt;&lt;TD width="105.188px"&gt;15201&lt;/TD&gt;&lt;TD width="139.5px"&gt;&lt;P&gt;text.txt text.html&lt;/P&gt;&lt;/TD&gt;&lt;TD width="148.962px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="94.65px"&gt;continue&lt;/TD&gt;&lt;TD width="129.562px"&gt;outbound_clean&lt;/TD&gt;&lt;TD width="69.2px"&gt;TLSv1.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"timestamp"&lt;/STRONG&gt; column&amp;nbsp; in above example should get changed according to local time zone when we execute query.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 16:27:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-function-or-query-which-will-convert-event-timestamp/m-p/592492#M206218</guid>
      <dc:creator>Abhineet</dc:creator>
      <dc:date>2022-04-05T16:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk function or query which will convert event timestamp field  "timestamp" to local timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-function-or-query-which-will-convert-event-timestamp/m-p/592500#M206221</link>
      <description>&lt;P&gt;The &lt;STRONG&gt;_time&lt;/STRONG&gt; field is stored as a unix timestamp (number of seconds since so-called "epoch") and is rendered in webui according to the timezone defined in user's preferences. There is no way to set another timezone within a search.&lt;/P&gt;&lt;P&gt;If you want to parse another field from the event (which is most likely represented in some string form), you should use strptime() to convert from that string to timestamp and then use fieldformat (preferably) or eval with strftime to convert this timestamp to a string.&lt;/P&gt;&lt;P&gt;And again - splunk always shows the timestamp in user's timezone but can parse and interpret a timezone if it's included in the date string. Otherwise it parses the datetime string as if it was in local time.&lt;/P&gt;&lt;P&gt;For example - if I'm located in CEST, the string "5.04.2022 18:57:00", if I call strptime with proper format string will get interpreted as 18:57 CEST. But if the string says "5.04.2022 18:57:00PDT" and I tell splunk to use the timezone definition, it will get parsed as PDT time even though my local timezone is CEST. But if I call strftime on both timestamps, they will be both rendered in CEST, regardless of what timezone the initial string contained.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 16:59:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-function-or-query-which-will-convert-event-timestamp/m-p/592500#M206221</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-04-05T16:59:30Z</dc:date>
    </item>
  </channel>
</rss>

