Forum Discussion
Convert Date to String
- 2 years ago
Date.ToText(Date.From(DateTime.LocalNow()),[Format="ddMMMyyyy"])
Hi shuhn1229 - you need to consider one of the following to convert Date/DateTime to Text:
Date.ToText - PowerQuery M | Microsoft Learn
DateTime.FromText - PowerQuery M | Microsoft Learn
Text.From - PowerQuery M | Microsoft Learn
The second is probably better as you can define the format for the Datetime straight to DD-MM-YYYY (for example) without using Date.From step.
Here is good resource that list the date formats options:
Date Formatting in Power Query - Master 18 Custom Formats (gorilla.bi)
- shuhn12292 years agoResolver I
Hi thanks, this is great. I used Text.From(DateTime.Date( DateTime.LocalNow() )) and recieved the value 11/03/23, which is great. I hate to bug but unfortunately / cannot be used in file names. How would I got about dropping them?
- shuhn12292 years agoResolver I
Date.ToText(Date.From(DateTime.LocalNow()),[Format="ddMMMyyyy"])