Formating Date in PowerQuery

MedExcels

New Member
Joined
Feb 18, 2016
Messages
41
Hello,

Thank you all for your help.

I have a question about how to format a date in powerQuery. I want to format or convert for example 10115 to 01/01/2015 and 311215 to 31/12/2015.

Thank you very much
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi
If your 10115 is a number then you could use udf-function, for example
Code:
let
    source = 10115,
    NumToDate = (this as number) as date =>
    let
        year = Number.Mod(this,100)+2000,
        month = Number.Mod(Number.IntegerDivide(this,100),100),
        day = Number.IntegerDivide(this,10000)
    in
        #date(year,month,day)
in
    NumToDate(source)
If it is a string, then use NumToDate(Number.From("311215"))
Regards,
 
Last edited:
Upvote 0
Hi, I did what you show me but It dosen't work may be it depends on me because I am not experimented in PowerQuery
Would you like helping me by formatting the date directly in this file in this a link Document Cjoint
The date in the second column.

Thank you
 
Upvote 0
Thank you very much anvg good job
Could you show me how to insert this function in Power Query by step (because I really need that for others files).
 
Upvote 0

Forum statistics

Threads
1,224,153
Messages
6,176,729
Members
452,740
Latest member
MrCY

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