SOLVED

How to adjust date to desired format in Power Query?

%3CLINGO-SUB%20id%3D%22lingo-sub-2093134%22%20slang%3D%22en-US%22%3EHow%20to%20adjust%20date%20to%20desired%20format%20in%20Power%20Query%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2093134%22%20slang%3D%22en-US%22%3E%3CP%3ESystem%20date%20format%20is%26nbsp%3B%3CU%3EDD%2FM%2FYYYY%20hh%3Amm%3Ass%3C%2FU%3E%26nbsp%3B%20which%20is%2025%2F1%2F2021%2014%3A08%3A00%3C%2FP%3E%3CP%3EHow%20could%20I%20edit%20in%20Power%20Query%20to%20make%20it%20as%20what%20we%20want%3F%3C%2FP%3E%3CP%3EI%20would%20like%20to%20change%20into%26nbsp%3B%3CU%3EYYYY-MM-DD%26nbsp%3Bhh%3Amm%3Ass%3C%2FU%3E%26nbsp%3B%26nbsp%3Bwhere%20it%20should%20be%202021-01-25%2014%3A08%3A00%3C%2FP%3E%3CP%3EThank%20you%20very%20much!%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rachael_Tsang_0-1611564513043.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249081i5EDB1721F5A9295B%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rachael_Tsang_0-1611564513043.png%22%20alt%3D%22Rachael_Tsang_0-1611564513043.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2093134%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2093461%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20adjust%20date%20to%20desired%20format%20in%20Power%20Query%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2093461%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F941309%22%20target%3D%22_blank%22%3E%40Rachael_Tsang%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPower%20Query%20shows%20data%20in%20accordance%20to%20locale%20settings.%20You%20may%20change%20it%20here%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20578px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249092i148570B7FFA53601%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2093464%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20adjust%20date%20to%20desired%20format%20in%20Power%20Query%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2093464%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIndeed%20I%20browsed%20the%20previous%20questions%20asked%20by%20other%20persons%20they%20had%20mentioned%20your%20suggestion%20as%20well.%20Not%20work%20for%20me.%3C%2FP%3E%3CP%3EAlready%20selected%26nbsp%3B%20English%20(Canada)%20but%20the%20format%20is%20not%20changing.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rachael_Tsang_0-1611570496587.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249093i27A13C0C0C52CE34%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rachael_Tsang_0-1611570496587.png%22%20alt%3D%22Rachael_Tsang_0-1611570496587.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rachael_Tsang_1-1611570529280.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249094iD6F0C6723D3A02CB%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rachael_Tsang_1-1611570529280.png%22%20alt%3D%22Rachael_Tsang_1-1611570529280.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

System date format is DD/M/YYYY hh:mm:ss  which is 25/1/2021 14:08:00

How could I edit in Power Query to make it as what we want?

I would like to change into YYYY-MM-DD hh:mm:ss  where it should be 2021-01-25 14:08:00

Thank you very much!

Rachael_Tsang_0-1611570674755.png

 

 

6 Replies

@Rachael_Tsang 

Power Query shows data in accordance to locale settings. You may change it here

image.png

@Sergei Baklan 

Indeed I browsed the previous questions asked by other persons they had mentioned your suggestion as well. Not work for me.

Already selected  English (Canada) but the format is not changing.

Rachael_Tsang_0-1611570496587.png

Rachael_Tsang_1-1611570529280.png

 

 

@Rachael_Tsang 

To be sure, could you please share screenshot with Power Query locale setting?

@Sergei Baklan 

 

Sorry my power query is in Chinese. 

 

I did selected [English (Canada) ]as the locale. 

Rachael_Tsang_1-1611626501426.png

 

Rachael_Tsang_0-1611626446486.png

Best Response confirmed by Rachael_Tsang (New Contributor)
Solution

@Rachael_Tsang 

I found out the solution my own and would like to share with other people who had the same question. It is pretty simple after I noticed the function. You dont need to use any PQ formula actually. 

 

So here is my raw data with date format as DD MMM YYYY hh:mm

where I would like to change it into YYYY-MM-DD hh:mm:ss 

then I am going to split it into 2 columns which is Update Date and Update Time

meaning it is should be 1 columns is YYYY-MM-DD while another is hh:mm:ss.

Rachael_Tsang_0-1611629741188.png

 

Once I loaded my raw data into PQ, it is turning into DD/M/YYYY hh:mm:ss

1.JPG

Click the calendar and click the last option [Use region setting] 

*I am using a Chinese version so the translation is made by myself, it might not be the same as your default language. 

擷取.JPG

 

Select Date/Time for date format-preview

Select Date/Time for date format-previewSelect Date/Time for date format-previewSelect Date/Time for date format-previewSelect Date/Time for date format-preview

 

 

Once you pick the desired format. Change the upper section [Data Type] : Text

Then select again the one you have chosen. 

4.jpg

 

 

You Should be able to have this as shown. 

You Should be able to have thisYou Should be able to have this

@Rachael_Tsang 

Yes, but resulting [createTime] column contains texts, not datetime. Try to apply DateTime format to it.

 

If you need text, not datetime, you may create custom column with formulas like

Text.From([updateTime], "mgo-CM")

or better

DateTime.ToText([updateTime], "yyyy-MM-dd HH:mm:ss")