<?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: date type conversion error in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80060#M35910</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113273"&gt;@ashkd7310&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It's not possible. Spark does not support date types formatted in some other way except for yyyy-MM-dd. If you need another format, you will need to again convert the date type into string type, but with the format which you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 04:51:14 GMT</pubDate>
    <dc:creator>szymon_dybczak</dc:creator>
    <dc:date>2024-07-23T04:51:14Z</dc:date>
    <item>
      <title>date type conversion error</title>
      <link>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80048#M35907</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to convert the date in MM/dd/yyyy format. So I am first using&amp;nbsp;&lt;SPAN&gt;the date_format function and converting the date into&amp;nbsp;MM/dd/yyyy. So it becomes string. However, my use case is to have the data as date. so I am again converting the string into date by using to_date function. However, it becomes null when I am doing that way.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have tried many ways but unable to solve. Is this something databricks doesn't support to store the date in the format of&amp;nbsp; MM/dd/yyyy?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 02:55:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80048#M35907</guid>
      <dc:creator>ashkd7310</dc:creator>
      <dc:date>2024-07-23T02:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: date type conversion error</title>
      <link>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80060#M35910</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/113273"&gt;@ashkd7310&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It's not possible. Spark does not support date types formatted in some other way except for yyyy-MM-dd. If you need another format, you will need to again convert the date type into string type, but with the format which you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 04:51:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80060#M35910</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-07-23T04:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: date type conversion error</title>
      <link>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80082#M35919</link>
      <description>&lt;P&gt;Check with this method if it works.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Convert date to MM/dd/yyyy format (string)
df = df.withColumn("formatted_date", date_format("date", "MM/dd/yyyy"))

# Convert string back to date
df = df.withColumn("converted_date", to_date("formatted_date", "MM/dd/yyyy"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 07:27:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/date-type-conversion-error/m-p/80082#M35919</guid>
      <dc:creator>Rishabh-Pandey</dc:creator>
      <dc:date>2024-07-23T07:27:32Z</dc:date>
    </item>
  </channel>
</rss>

