power query advanced editor using m-code transforms dates incorrectely

breilly00

Board Regular
Joined
Sep 15, 2008
Messages
53
Office Version
  1. 365
Platform
  1. Windows
I have the following code that is not keeping the same date format as the input. The input dates are in a date column and have mm/dd/yyyy formatting in the cell (e. g. 5/7/2019). The result after running the following m-code is 07/05/2019 in a general format. How can I get the output dates to be the same as the input dates using the following code?


let
Source = Excel.Workbook(File.Contents("C:\Users\Sadie\MyDocuments\Excel\ExcelPowerBuilder\pb-v3-test.xlsm"), null, true),
Schedule_Sheet = Source{[Item="Schedule",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Schedule_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Time", type datetime}, {"Courts", Int64.Type}, {"Teams", type text}})
in
#"Changed Type"
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Have you checked your regional settings to ensure that they are what you want them to be.
 
Upvote 0
Yes, have went to windows 10 change date, tome or number formats and see the following.
Region is set to 'match windows display language'
short date is set to M/d/yyyy
example shows 7/26/2019
 
Upvote 0
also check Regional Settings in PQ Editor
File - Options and Settings - Query Options - Regional Settings - Locale (set to English (United States)
 
Last edited:
Upvote 0
OMG OMG .

I was using GB english instead of US english and they have dd/mm/yy and the US has mm/dd/yy. Such as simple solution, for me to overlook. But, the solution is always simple when someone else solves it for you.

My many thanks and appreciation for your excellent help. YOU ROCK !!!!
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top