Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joshua1990
Post Prodigy
Post Prodigy

Change HHMMSS to Time

I have a column that contains the time as HHMMSS like 120530 for 12:05:30 or 30503 for 03:05:03.

How is it possible to change this to a data type of time?

1 ACCEPTED SOLUTION
JEC
Regular Visitor

Input

JEC_0-1689502614202.png

 

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    cType = Table.TransformColumnTypes(Source,{{"time", Int64.Type}}),
    convert = Table.TransformColumns(cType,{{"time", (x)=> let t = Text.From(x) in List.Accumulate({4,2}, if Text.Length(t) = 5 then "0" & t else t , (s,c)=>  Text.Insert(s,c,":"))}}),
    out = Table.TransformColumnTypes(convert,{{"time", type time}})
in
    out

 

 

 Output

JEC_1-1689502785541.png

 

 

View solution in original post

1 REPLY 1
JEC
Regular Visitor

Input

JEC_0-1689502614202.png

 

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    cType = Table.TransformColumnTypes(Source,{{"time", Int64.Type}}),
    convert = Table.TransformColumns(cType,{{"time", (x)=> let t = Text.From(x) in List.Accumulate({4,2}, if Text.Length(t) = 5 then "0" & t else t , (s,c)=>  Text.Insert(s,c,":"))}}),
    out = Table.TransformColumnTypes(convert,{{"time", type time}})
in
    out

 

 

 Output

JEC_1-1689502785541.png

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors