<?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: Covert Text type to DateTime type in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4233056#M57741</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/601181"&gt;@TanLC&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I test with&amp;nbsp;&lt;SPAN&gt;rajasaadk_98's code, you just need to use your column name to replace the string and add the table from.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;USE [Test]
GO

SELECT [Category],
FORMAT(CONVERT(DATETIME,
SUBSTRING(DateTime, 1, 2) + '/' + -- Day
SUBSTRING(DateTime, 3, 2) + '/' + -- Month
SUBSTRING(DateTime, 5, 4) + ' ' + -- Year
SUBSTRING(DateTime, 9, 2) + ':' + -- Hour
SUBSTRING(DateTime, 11, 2) + ':' + -- Minute
SUBSTRING(DateTime, 13, 2) -- Second
, 103), 'dd/MM/yyyy hh:mm:ss tt') AS FormattedDate
FROM [dbo].[Table_1]
;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_0-1728371565680.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1179428i873F4D24F955D54C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_0-1728371565680.png" alt="vrzhoumsft_0-1728371565680.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2024 07:14:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-10-08T07:14:06Z</dc:date>
    <item>
      <title>Covert Text type to DateTime type</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231114#M57709</link>
      <description>&lt;P&gt;Hi,&amp;nbsp; kindly advice on how to convert "24052024044827" to "24/05/2024 04:48:27 AM" using SQL Syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LC&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 03:56:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231114#M57709</guid>
      <dc:creator>TanLC</dc:creator>
      <dc:date>2024-10-07T03:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Covert Text type to DateTime type</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231178#M57715</link>
      <description>&lt;P&gt;To convert the string "24052024044827" into the desired date and time format "24/05/2024 04:48:27 AM" in SQL (within Power BI or SQL Server), you can follow these steps:&lt;/P&gt;&lt;H3&gt;SQL Syntax:&lt;/H3&gt;&lt;P&gt;You will need to break the string into parts and then use CONVERT or FORMAT functions to assemble it as a datetime format.&lt;/P&gt;&lt;P&gt;Here’s a solution that works in SQL Server:&lt;BR /&gt;SELECT FORMAT(CONVERT(DATETIME,&lt;BR /&gt;SUBSTRING('24052024044827', 1, 2) + '/' + -- Day&lt;BR /&gt;SUBSTRING('24052024044827', 3, 2) + '/' + -- Month&lt;BR /&gt;SUBSTRING('24052024044827', 5, 4) + ' ' + -- Year&lt;BR /&gt;SUBSTRING('24052024044827', 9, 2) + ':' + -- Hour&lt;BR /&gt;SUBSTRING('24052024044827', 11, 2) + ':' + -- Minute&lt;BR /&gt;SUBSTRING('24052024044827', 13, 2) -- Second&lt;BR /&gt;, 103), 'dd/MM/yyyy hh:mm:ss tt') AS FormattedDate;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 05:52:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231178#M57715</guid>
      <dc:creator>rajasaadk_98</dc:creator>
      <dc:date>2024-10-07T05:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: Covert Text type to DateTime type</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231274#M57717</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/820120"&gt;@rajasaadk_98&lt;/a&gt;&amp;nbsp;thanks for the syntax given. What if in the same column, there are actually blank records, SUBSTRING will not be able to work...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LC&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 06:51:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4231274#M57717</guid>
      <dc:creator>TanLC</dc:creator>
      <dc:date>2024-10-07T06:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Covert Text type to DateTime type</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4233056#M57741</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/601181"&gt;@TanLC&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I test with&amp;nbsp;&lt;SPAN&gt;rajasaadk_98's code, you just need to use your column name to replace the string and add the table from.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;USE [Test]
GO

SELECT [Category],
FORMAT(CONVERT(DATETIME,
SUBSTRING(DateTime, 1, 2) + '/' + -- Day
SUBSTRING(DateTime, 3, 2) + '/' + -- Month
SUBSTRING(DateTime, 5, 4) + ' ' + -- Year
SUBSTRING(DateTime, 9, 2) + ':' + -- Hour
SUBSTRING(DateTime, 11, 2) + ':' + -- Minute
SUBSTRING(DateTime, 13, 2) -- Second
, 103), 'dd/MM/yyyy hh:mm:ss tt') AS FormattedDate
FROM [dbo].[Table_1]
;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vrzhoumsft_0-1728371565680.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1179428i873F4D24F955D54C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vrzhoumsft_0-1728371565680.png" alt="vrzhoumsft_0-1728371565680.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 07:14:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Covert-Text-type-to-DateTime-type/m-p/4233056#M57741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-08T07:14:06Z</dc:date>
    </item>
  </channel>
</rss>

