Forum Discussion
Smartnag
3 years agoFrequent Visitor
Date & time format change in power query
Hi All, I am getting the date from the source in below format, i want date & time should be in MM/DD/YYYY HH:MM:SS AM/PM. 20140706 17:23 How do i change in Power Query. Thanks, Sm...
erothen
3 years agoFrequent Visitor
You'll need to use the DateTime.ToText function.
Function documentation- https://learn.microsoft.com/en-us/powerquery-m/datetime-totext
Format specifiers- https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
Example that should work for you depending on current culture (if this doesn't work, add a specified format [Format="x", Culture="y"])-
Usage
DateTime.ToText(#datetime(2010, 12, 31, 01, 30, 25))
Output
"12/31/2010 1:30:25 AM"
Smartnag
3 years agoFrequent Visitor
Thanks for the reply, i tried in both the ways.
got the below errors.
And the date time is coming from the source is text format.
| 20160821 09:15 |
Thanks,
Smartnag