Forum Discussion
lardo5150
Microsoft Employee
6 years agoConvert Excel Serial Date to normal m/d/yyyy hh:mm
I have created a flow that grabs an excel, does some stuff, and then imports it to SharePoint. I then grab the SharePoint list. The problem is the date is still in the Excel format: Examples: ...
- 6 years ago
Hi lardo5150 ,
You can try steps like below:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcjBCcAwDAPAXfwuxqlkOZ4leP81AoXe884xoiRXbJAdRZvny4Rnc6Na+I/lfHMFl1Q2cwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type number}}), #"Split Column by Character Transition" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"date", type text}}, "en-US"), "date", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"date.1", "date.2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Character Transition",{{"date.1", Int64.Type}, {"date.2", type number}}), #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.AddDays(#date(1900, 01, 01), [date.1])), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Time.From([date.2])), #"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1",{{"Custom", type date}, {"Custom.1", type time}}), #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type2", {{"Custom", type text}, {"Custom.1", type text}}, "en-US"),{"Custom", "Custom.1"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"), #"Changed Type3" = Table.TransformColumnTypes(#"Merged Columns",{{"Merged", type datetime}}) in #"Changed Type3"Here is the sample pbix.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
V-lianl-msft
Community Support
6 years agoHi lardo5150 ,
You can try steps like below:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcjBCcAwDAPAXfwuxqlkOZ4leP81AoXe884xoiRXbJAdRZvny4Rnc6Na+I/lfHMFl1Q2cwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type number}}),
#"Split Column by Character Transition" = Table.SplitColumn(Table.TransformColumnTypes(#"Changed Type", {{"date", type text}}, "en-US"), "date", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"date.1", "date.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Character Transition",{{"date.1", Int64.Type}, {"date.2", type number}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Date.AddDays(#date(1900, 01, 01), [date.1])),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Time.From([date.2])),
#"Changed Type2" = Table.TransformColumnTypes(#"Added Custom1",{{"Custom", type date}, {"Custom.1", type time}}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type2", {{"Custom", type text}, {"Custom.1", type text}}, "en-US"),{"Custom", "Custom.1"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
#"Changed Type3" = Table.TransformColumnTypes(#"Merged Columns",{{"Merged", type datetime}})
in
#"Changed Type3"Here is the sample pbix.
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lardo5150
Microsoft Employee
6 years agoEXACTLY what I was looking for and I was able to follow what you were doing.
Providing the sample was a BIG help.
THANK YOU