<?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: String to date conversion errors in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105630#M9535</link>
    <description>&lt;P&gt;Checking on my current code, this is what I am using, which works for me because we don't use daylight savings time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from_utc_timestamp(date_time_utc, &lt;/SPAN&gt;&lt;SPAN&gt;'UTC-7'&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; date_time_local&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 14 Jan 2025 17:44:23 GMT</pubDate>
    <dc:creator>SamGreene</dc:creator>
    <dc:date>2025-01-14T17:44:23Z</dc:date>
    <item>
      <title>String to date conversion errors</title>
      <link>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/71530#M9531</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am getting data from CDC on SQL Server using Informatica which is writing parquet files to ADLS.&amp;nbsp; I read the parquet files using DLT and end up with the date data as a string such as this&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'20240603164746563'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I couldn't get this to convert using milliseconds without a strict parser error that says to use the legacy option, which is not available to use. So I did a LEFT on the data to get rid of the MS and get this:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;,TO_TIMESTAMP(&lt;/SPAN&gt;&lt;SPAN&gt;LEFT&lt;/SPAN&gt;&lt;SPAN&gt;(event_time,&lt;/SPAN&gt;&lt;SPAN&gt;14&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'yyyyMMddHHmmss'&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;AS&lt;/SPAN&gt;&lt;SPAN&gt; event_datetime&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Then I convert to my local timezone:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;,CONVERT_TIMEZONE(&lt;/SPAN&gt;&lt;SPAN&gt;'UTC'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'America/Phoenix'&lt;/SPAN&gt;&lt;SPAN&gt;,TO_TIMESTAMP(&lt;/SPAN&gt;&lt;SPAN&gt;LEFT&lt;/SPAN&gt;&lt;SPAN&gt;(event_time,&lt;/SPAN&gt;&lt;SPAN&gt;14&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'yyyyMMddHHmmss'&lt;/SPAN&gt;&lt;SPAN&gt;))&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;When I run the DLT pipeline I get this error:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Your table schema requires manually enablement of the following table feature(s): timestampNtz.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALTER&lt;/SPAN&gt; &lt;SPAN&gt;TABLE&lt;/SPAN&gt;&lt;SPAN&gt; table_name &lt;/SPAN&gt;&lt;SPAN&gt;SET&lt;/SPAN&gt;&lt;SPAN&gt; TBLPROPERTIES (&lt;/SPAN&gt;&lt;SPAN&gt;'delta.feature.feature_name'&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;'supported'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However, I cannot run this code as it is a Live table.&amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Someone please help me out as I feel like I'm really missing something by having so much trouble with what should be an easy task!&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 03 Jun 2024 22:27:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/71530#M9531</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2024-06-03T22:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: String to date conversion errors</title>
      <link>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105148#M9533</link>
      <description>&lt;P&gt;I am also running into a similar problem. did you ever resolve this?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 10:34:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105148#M9533</guid>
      <dc:creator>wt-asw</dc:creator>
      <dc:date>2025-01-10T10:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: String to date conversion errors</title>
      <link>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105298#M9534</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/142202"&gt;@wt-asw&lt;/a&gt;&amp;nbsp;I ran into the same problem, I have provided the table properties at the table declaration as below. Hope this helps!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;CREATE OR REFRESH LIVE TABLE silver_table_name_mv
TBLPROPERTIES ('delta.feature.timestampNtz' = 'supported')

AS 

SELECT
...
;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2025 17:28:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105298#M9534</guid>
      <dc:creator>IdleGuys</dc:creator>
      <dc:date>2025-01-11T17:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: String to date conversion errors</title>
      <link>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105630#M9535</link>
      <description>&lt;P&gt;Checking on my current code, this is what I am using, which works for me because we don't use daylight savings time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from_utc_timestamp(date_time_utc, &lt;/SPAN&gt;&lt;SPAN&gt;'UTC-7'&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; date_time_local&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Jan 2025 17:44:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/string-to-date-conversion-errors/m-p/105630#M9535</guid>
      <dc:creator>SamGreene</dc:creator>
      <dc:date>2025-01-14T17:44:23Z</dc:date>
    </item>
  </channel>
</rss>

