Forum

24 Hour Clock Times
 
Notifications
Clear all

24 Hour Clock Times

3 Posts
3 Users
0 Reactions
1,373 Views
(@raffrobb)
Posts: 38
Trusted Member
Topic starter
 

How do I convert  1:00 PM or 11:56 PM to 24 hour clock time in Power Query?

 

Thanks

Robb

 
Posted : 20/09/2020 9:44 pm
(@bluesky63)
Posts: 162
Estimable Member
 

Hi

in Power Query Editor,  format to time,  create a custom column

Time.ToText([Time], "hh:mm")

 

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Time", type time}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Time.ToText([Time], "hh:mm"))
in
#"Added Custom"

 
Posted : 21/09/2020 3:51 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Robert,

Chris' solution converts the times to text which will render them useless in formulas when you Close & Load. This may not be a problem, but if it is, you should apply the formatting once the data lands in Excel. Power Query is not where you do the formatting. Power Query is for getting the data, cleaning it and loading it to Excel where you can apply the formatting.

Mynda

 
Posted : 21/09/2020 5:08 am
Share: