<?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 to convert timestamp to date and time with timezone? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611027#M105846</link>
    <description>&lt;P&gt;&lt;SPAN&gt;2017-09-21T20:48:48.535427Z this is the sample timestamp and I have rounded it to &amp;nbsp;hour like 2017-09-21T20:00:00 now I want to convert it to human readable format as mentioned above may be what I am doing may be wrong I am still learning splunk&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 23:38:12 GMT</pubDate>
    <dc:creator>Sammy13</dc:creator>
    <dc:date>2022-08-26T23:38:12Z</dc:date>
    <item>
      <title>How to convert timestamp to date and time with timezone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611013#M105842</link>
      <description>&lt;P&gt;Hi, I have a field with timestamp value "2017-09-21T20:00:00" in format. I need to convert it to the&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;date and time with time zone&amp;nbsp;&amp;nbsp;For example,&amp;nbsp;Thu Jul 18 09:30:00 PDT 2022 please do help thanks&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 22:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611013#M105842</guid>
      <dc:creator>Sammy13</dc:creator>
      <dc:date>2022-08-26T22:17:04Z</dc:date>
    </item>
    <item>
      <title>Convert timestamp to date and time with timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611021#M105843</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248904"&gt;@Sammy13&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;is there really a "T" in there, or is that a typo? Can you show us an actual log entry? obfuscate any sensitive data&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 20:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611021#M105843</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2022-08-26T20:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert timestamp to date and time with timezone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611027#M105846</link>
      <description>&lt;P&gt;&lt;SPAN&gt;2017-09-21T20:48:48.535427Z this is the sample timestamp and I have rounded it to &amp;nbsp;hour like 2017-09-21T20:00:00 now I want to convert it to human readable format as mentioned above may be what I am doing may be wrong I am still learning splunk&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 23:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611027#M105846</guid>
      <dc:creator>Sammy13</dc:creator>
      <dc:date>2022-08-26T23:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert timestamp to date and time with timezone?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611036#M105848</link>
      <description>&lt;P&gt;| makeresults&lt;BR /&gt;| eval field1="2022-08-27T02:00:00"&lt;BR /&gt;| eval field2=strptime(field1,"%Y-%m-%dT%H:%M:%S")&lt;BR /&gt;| eval field3=relative_time(field2,"+8h")&lt;BR /&gt;| eval field4=strftime(field3,"%a %b %d %H:%M:%S.%Z %Y")&lt;BR /&gt;| table field1 field2 field3 field4&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="liuce1_2-1661568905705.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21223iEBE6D8DF634F055D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="liuce1_2-1661568905705.png" alt="liuce1_2-1661568905705.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First , using "strptime" function to transform String time "2022-08-27T02:00:00" to Unix timestamp field2 base on my time zone( My time zone setting is UTC+8, Splunk consider the time zone of String time as UTC+8,&amp;nbsp; so the Unix timestamp value is &lt;SPAN&gt;1661536800&lt;/SPAN&gt;). You can check your time zone setting as below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="liuce1_0-1661568673438.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21221i8963356D3ED9AB10/image-size/medium?v=v2&amp;amp;px=400" role="button" title="liuce1_0-1661568673438.png" alt="liuce1_0-1661568673438.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="liuce1_1-1661568722578.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21222i57A852600952A4C2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="liuce1_1-1661568722578.png" alt="liuce1_1-1661568722578.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second,&amp;nbsp; I know the time zone of String time is UTC not UTC+8,&amp;nbsp; so I use "relative_time" function to add 8 hous to field2 , then I get field3&lt;/P&gt;&lt;P&gt;Finally, using "strftime" function to transform Unix timestamp to human readable format field 4&lt;/P&gt;&lt;P&gt;The date and time format variables I used ,&amp;nbsp; you can find them in this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.1/SearchReference/Commontimeformatvariables" target="_blank"&gt;Date and time format variables - Splunk Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope my answer can help you.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Aug 2022 03:06:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-timestamp-to-date-and-time-with-timezone/m-p/611036#M105848</guid>
      <dc:creator>liuce1</dc:creator>
      <dc:date>2022-08-27T03:06:31Z</dc:date>
    </item>
  </channel>
</rss>

