Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a date field that needs to be converted to nvarchar. In Power Query, I select the field and change the date type to text. How can I ensure that the time is not displayed from the field?
I also using this sytax to convert to txt field without showing time, but it didnt' work.
Text.From([#"Backlog[Order Date]"],"YYYY-MM-DD")
Solved! Go to Solution.
Hi @hongho2 ,
Please have a try.
One way is to use the DateTime.ToText function, which returns a textual representation of a datetime value. You can specify the format and the culture of the output as optional parameters.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each DateTime.ToText(_, “MMM d yyyy”), type text}})
This will transform the column “Date” from datetime to text, using the format “MMM d yyyy”.
DateTime.ToText - PowerQuery M | Microsoft Learn
Another way is to use the Date.ToText function, which returns a textual representation of a date value. This function is similar to DateTime.ToText, but it only works with date values, not datetime values.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each Date.ToText(_, “dd MMM yyyy”), type text}})
This will transform the column “Date” from date to text, using the format “dd MMM yyyy”.
Date.ToText - PowerQuery M | Microsoft Learn
A third way is to use the Text.From function, which returns a textual representation of any value.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each Text.From(_), type text}})
This will transform the column “Date” from any type to text, using the default format.
Solved: Converting specific text to date in PowerQuery - Microsoft Fabric Community
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you very much !
Hi @hongho2 ,
Please have a try.
One way is to use the DateTime.ToText function, which returns a textual representation of a datetime value. You can specify the format and the culture of the output as optional parameters.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each DateTime.ToText(_, “MMM d yyyy”), type text}})
This will transform the column “Date” from datetime to text, using the format “MMM d yyyy”.
DateTime.ToText - PowerQuery M | Microsoft Learn
Another way is to use the Date.ToText function, which returns a textual representation of a date value. This function is similar to DateTime.ToText, but it only works with date values, not datetime values.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each Date.ToText(_, “dd MMM yyyy”), type text}})
This will transform the column “Date” from date to text, using the format “dd MMM yyyy”.
Date.ToText - PowerQuery M | Microsoft Learn
A third way is to use the Text.From function, which returns a textual representation of any value.
= Table.TransformColumns(#“Previous Step”, {{“Date”, each Text.From(_), type text}})
This will transform the column “Date” from any type to text, using the default format.
Solved: Converting specific text to date in PowerQuery - Microsoft Fabric Community
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Rongtie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
pls try this
= Date.ToText(Date.From([Order Date]))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
106 | |
87 | |
77 | |
69 |
User | Count |
---|---|
124 | |
112 | |
94 | |
84 | |
75 |