<?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: to_utc_timestamp is subtracting a different time delta and from_utc_timestamp is not adding the same delta. in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2875#M29</link>
    <description>&lt;P&gt;Hi @Rahul Lalwani​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does @Kaniz Fatma​'s response answer your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2023 15:02:47 GMT</pubDate>
    <dc:creator>Vartika</dc:creator>
    <dc:date>2023-06-19T15:02:47Z</dc:date>
    <item>
      <title>to_utc_timestamp is subtracting a different time delta and from_utc_timestamp is not adding the same delta.</title>
      <link>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2873#M27</link>
      <description>&lt;P&gt;My session timezone is Australia/Sydney&lt;/P&gt;&lt;P&gt;if i run the below query my expectation is first column and third column should show the same value. But it is not working as expected for 1753-01-01 00:00:00 timestamp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;spark.conf.set("spark.sql.session.timeZone",&amp;nbsp;"Australia/Sydney") &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select '1753-01-01 00:0:00' original_timestamp,to_utc_timestamp('1753-01-01 00:0:00', "Australia/Sydney") to_utc_from_aest ,from_utc_timestamp(to_utc_timestamp('1753-01-01 00:0:00', "Australia/Sydney"),"Australia/Sydney") from_utc_to_aest&lt;/P&gt;&lt;P&gt;UNION all&lt;/P&gt;&lt;P&gt;select '2023-01-01 00:0:00',to_utc_timestamp('2023-01-01 00:0:00', "Australia/Sydney"),from_utc_timestamp(to_utc_timestamp('2023-01-01 00:0:00', "Australia/Sydney"),"Australia/Sydney")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/69i7FD4BF3E6832297E/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 01:30:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2873#M27</guid>
      <dc:creator>rahullalwani25</dc:creator>
      <dc:date>2023-06-19T01:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: to_utc_timestamp is subtracting a different time delta and from_utc_timestamp is not adding the same delta.</title>
      <link>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2875#M29</link>
      <description>&lt;P&gt;Hi @Rahul Lalwani​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does @Kaniz Fatma​'s response answer your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2023 15:02:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2875#M29</guid>
      <dc:creator>Vartika</dc:creator>
      <dc:date>2023-06-19T15:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: to_utc_timestamp is subtracting a different time delta and from_utc_timestamp is not adding the same delta.</title>
      <link>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2876#M30</link>
      <description>&lt;P&gt;Hello Kaniz,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's working till 1896-01-01 00:00:00 which rules out the spark's supported date range issue.&lt;/P&gt;&lt;P&gt;Secondly I don't want the accurate timestamp but time delta subtracted in to_utc_timestamp should be the exact value being added in from_utc_timestamp or vice versa but in the snippets you can see there is 5 minutes +- issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/66iF53A2C691856C681/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;P.S. It works correctly on job cluster and sql warehouse. This issue is only in interactive cluster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 00:45:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2876#M30</guid>
      <dc:creator>rahullalwani25</dc:creator>
      <dc:date>2023-06-20T00:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: to_utc_timestamp is subtracting a different time delta and from_utc_timestamp is not adding the same delta.</title>
      <link>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2877#M31</link>
      <description>&lt;P&gt;Hi @Rahul Lalwani​&amp;nbsp;&amp;nbsp;(Customer)​,&lt;/P&gt;&lt;P&gt;In Interactive cluster spark.sql.datetime.java8API.enabled is disabled when we enable&amp;nbsp;&lt;B&gt;spark.sql.datetime.java8API.enabled to true ,&amp;nbsp;&lt;/B&gt;we can see crt values for 1753-01-01 as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason for enabling the above config is because in Date and timestamp string literals are parsed by using Java 8 time API and Spark's session time zone. Before the changes, date/timestamp values were collected as legacy types `java.sql.Date`/`java.sql.Timestamp`, and the value of such types didn't respect the config `spark.sql.session.timeZone`. To have consistent view, users had to keep JVM time zone and Spark's session time zone in sync.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/87iD774B5211FEB9851/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;So please enable &lt;B&gt;spark.sql.datetime.java8API.enabled to true &lt;/B&gt;for the correct time format.&lt;/P&gt;&lt;P&gt;And the reason for 5 mins difference is due to standardization of timezones till 1895 the offset was UTC+10:05 post that i.e from 1896 the offset is UTC+10:00.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 13:42:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/to-utc-timestamp-is-subtracting-a-different-time-delta-and-from/m-p/2877#M31</guid>
      <dc:creator>Pavithra_R</dc:creator>
      <dc:date>2023-06-22T13:42:01Z</dc:date>
    </item>
  </channel>
</rss>

