<?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 Conversion of time zone from UTC to US/Eastern in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/conversion-of-time-zone-from-utc-to-us-eastern/m-p/92792#M38543</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to databricks and i am writing a query to fetch the data from Databricks and encountered with an error. Please see below the query details and the error. Any help would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You in Advance !&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;cast(&lt;/SPAN&gt;&lt;SPAN&gt;TO_UTC_TIMESTAMP_TZ(&lt;/SPAN&gt;&lt;SPAN&gt;Cast(substr(&lt;/SPAN&gt;&lt;SPAN&gt;START_DATE_TIME,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;22&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'UTC'&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;SPAN&gt;AT&lt;/SPAN&gt; &lt;SPAN&gt;TIME&lt;/SPAN&gt; &lt;SPAN&gt;ZONE&lt;/SPAN&gt; &lt;SPAN&gt;'US/Eastern'&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; START_DT_ET (This line of code is at Line 17 and the error is referring to this particular Line's code.)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Error:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near 'AT'. SQLSTATE: 42601 line 17, pos 111&lt;/P&gt;&lt;P&gt;, cast(TO_UTC_TIMESTAMP_TZ(Cast(substr(CREATION_DATE_TIME,1,22), 'UTC')) AT TIME ZONE 'US/Eastern' as DATE) as START_DT_ET&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 04 Oct 2024 19:37:55 GMT</pubDate>
    <dc:creator>Majid</dc:creator>
    <dc:date>2024-10-04T19:37:55Z</dc:date>
    <item>
      <title>Conversion of time zone from UTC to US/Eastern</title>
      <link>https://community.databricks.com/t5/data-engineering/conversion-of-time-zone-from-utc-to-us-eastern/m-p/92792#M38543</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to databricks and i am writing a query to fetch the data from Databricks and encountered with an error. Please see below the query details and the error. Any help would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You in Advance !&amp;nbsp;&lt;/P&gt;&lt;P&gt;Query:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;cast(&lt;/SPAN&gt;&lt;SPAN&gt;TO_UTC_TIMESTAMP_TZ(&lt;/SPAN&gt;&lt;SPAN&gt;Cast(substr(&lt;/SPAN&gt;&lt;SPAN&gt;START_DATE_TIME,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;22&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'UTC'&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;SPAN&gt;AT&lt;/SPAN&gt; &lt;SPAN&gt;TIME&lt;/SPAN&gt; &lt;SPAN&gt;ZONE&lt;/SPAN&gt; &lt;SPAN&gt;'US/Eastern'&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; START_DT_ET (This line of code is at Line 17 and the error is referring to this particular Line's code.)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Error:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near 'AT'. SQLSTATE: 42601 line 17, pos 111&lt;/P&gt;&lt;P&gt;, cast(TO_UTC_TIMESTAMP_TZ(Cast(substr(CREATION_DATE_TIME,1,22), 'UTC')) AT TIME ZONE 'US/Eastern' as DATE) as START_DT_ET&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 04 Oct 2024 19:37:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/conversion-of-time-zone-from-utc-to-us-eastern/m-p/92792#M38543</guid>
      <dc:creator>Majid</dc:creator>
      <dc:date>2024-10-04T19:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of time zone from UTC to US/Eastern</title>
      <link>https://community.databricks.com/t5/data-engineering/conversion-of-time-zone-from-utc-to-us-eastern/m-p/92798#M38544</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/124751"&gt;@Majid&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Spark SQL doesn't support&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;AT&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;TIME&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ZONE, that's why you've got this error. To achieve similar result, you can use &lt;STRONG&gt;to_utc_timestamp&lt;/STRONG&gt; or &lt;STRONG&gt;from_utc_timestamp function.&amp;nbsp;&lt;/STRONG&gt;Those functions support timezone parameter:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.databricks.com/en/sql/language-manual/functions/to_utc_timestamp.html" target="_blank"&gt;https://docs.databricks.com/en/sql/language-manual/functions/to_utc_timestamp.html&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2024 20:20:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/conversion-of-time-zone-from-utc-to-us-eastern/m-p/92798#M38544</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-10-04T20:20:41Z</dc:date>
    </item>
  </channel>
</rss>

