Forum Discussion

Mideai's avatar
Mideai
New Member
3 years ago

Convert to 24 hour Time

Please I need help. I want to convert this data into 24 hour time 

2 Replies

  • let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrDIMDZQitWJVjI0zTAxhbAMMgygYuZwlmGGIVA2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
        #"Replaced Value" = Table.ReplaceValue(Source,"h",":",Replacer.ReplaceText,{"Column1"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value",{{"Column1", type time}})
    in
        #"Changed Type1"

    How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

     

    What is your expected result for "morning"  ?

  • Anonymous's avatar
    Anonymous
    Not applicable

    First of all, you need to make sure all your time data is in the same format - don't have "Morning" and then 00h30, as this makes the column hard to convert. 

    1. Manually change every value to the 00h30 (24hour,h,60min) format. 

    1.5 You may need to replace every instance of the letter "h" with  a " : ", so that your time becomes 00:30

    2. Then either in powerQuerry or PoweBI, you can convert this to a time format. See below