<?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 date to string in Data &amp; Schema Discussions</title>
    <link>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5629#M466</link>
    <description>&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/1002"&gt;@KKR&lt;/a&gt;&amp;nbsp;- Were&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/24"&gt;@RADSr&lt;/a&gt;&amp;nbsp;and I able to provide a solution for you?&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2024 13:15:27 GMT</pubDate>
    <dc:creator>JoeM</dc:creator>
    <dc:date>2024-04-04T13:15:27Z</dc:date>
    <item>
      <title>how to convert date to string</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5608#M457</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have two columns , one is timestamp and another one is string. I want to join these two columns in spark sql mv.&lt;/P&gt;&lt;P&gt;Date_effective column is timestamp with "yyyy-mm-dd hh:mm:ss" format.&lt;/P&gt;&lt;P&gt;Period_name column is string with "mm-yy" format. I want write below oracle query in Sparl sql, could you please let me know how to write?&lt;/P&gt;&lt;P&gt;Oracle query join: t&lt;SPAN&gt;&lt;SPAN class=""&gt;o_char(table_name.date_effective,'mm-yy')=table_name.period_name.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2024 09:59:47 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5608#M457</guid>
      <dc:creator>KKR</dc:creator>
      <dc:date>2024-04-01T09:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date to string</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5618#M461</link>
      <description>&lt;P&gt;Here is how I got it to work:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from pyspark.sql.functions import col, expr

df1 = read("[datestable]")
df2 = read("[periodstable]")

df1 = df1.withColumn("month_year", expr("substring(date, 6, 2) || '-' || substring(date, 3, 2)"))
joined_df = df1.join(df2, "month_year")
joined_df.show()&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Apr 2024 20:04:40 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5618#M461</guid>
      <dc:creator>JoeM</dc:creator>
      <dc:date>2024-04-01T20:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date to string</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5621#M462</link>
      <description>&lt;P&gt;My prior replies got bounced ( and&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/3"&gt;@JoeM&lt;/a&gt;&amp;nbsp; gave a good answer already below ) but I'm going to try, try again...&lt;/P&gt;&lt;P&gt;Here's a quick MV snip using SPARK SQL which will get you where you want to go.&lt;/P&gt;&lt;P&gt;That said and pro tip - having the period_name integrated into your date dimension will make this easier.&amp;nbsp; Build out your date dimension!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;===================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%sql&lt;BR /&gt;select timestamp AS TS&lt;BR /&gt;, case&lt;BR /&gt;WHEN month(timestamp) &amp;lt; 10&lt;BR /&gt;THEN concat('0', month(timestamp), '-', substring(year(timestamp), 3, 2))&lt;BR /&gt;ELSE month(timestamp)&lt;BR /&gt;END AS CS&lt;/P&gt;&lt;P&gt;, * from Audit.audit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RADSr_0-1712080382141.png" style="width: 400px;"&gt;&lt;img src="https://community.incorta.com/t5/image/serverpage/image-id/2583iED4D4901CED2D7A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RADSr_0-1712080382141.png" alt="RADSr_0-1712080382141.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 17:53:48 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5621#M462</guid>
      <dc:creator>RADSr</dc:creator>
      <dc:date>2024-04-02T17:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date to string</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5629#M466</link>
      <description>&lt;P&gt;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/1002"&gt;@KKR&lt;/a&gt;&amp;nbsp;- Were&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/24"&gt;@RADSr&lt;/a&gt;&amp;nbsp;and I able to provide a solution for you?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 13:15:27 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/how-to-convert-date-to-string/m-p/5629#M466</guid>
      <dc:creator>JoeM</dc:creator>
      <dc:date>2024-04-04T13:15:27Z</dc:date>
    </item>
  </channel>
</rss>

