Forum Discussion
Change Date format
- Anonymous2 years ago
Hi RMtechm ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) Click on "transform data" to enter the power query editor, split the columns twice then change the data type and finally delete the extra columns.
You can open the "Advanced Editor" and copy and paste the following code and check the steps in the right step column.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcivKTEmsVPBPLslPSi1SMDRWMDIwMlYwNLAytLAyNldw9FUIdwxRio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}}), #"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Date", "Date - Copy"), #"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Date - Copy", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Date - Copy.1", "Date - Copy.2"}), #"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter", "Date - Copy.2", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Date - Copy.2.1", "Date - Copy.2.2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Date - Copy.1", type text}, {"Date - Copy.2.1", type datetime}, {"Date - Copy.2.2", type text}}), #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date", "Date - Copy.1", "Date - Copy.2.2"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Date - Copy.2.1", "Date"}}) in #"Renamed Columns"Click "Apply and Close" to adjust the formatting in the desktop table view.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 2 years ago
Hello @Neeko Tang,
Thanks for the replay exactly i also did it the same way & it works but i was looking is there any way if we can do this in single column, but no worries thanks for the solution.
Hi RMtechm ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) Click on "transform data" to enter the power query editor, split the columns twice then change the data type and finally delete the extra columns.
You can open the "Advanced Editor" and copy and paste the following code and check the steps in the right step column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcivKTEmsVPBPLslPSi1SMDRWMDIwMlYwNLAytLAyNldw9FUIdwxRio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "Date", "Date - Copy"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Duplicated Column", "Date - Copy", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Date - Copy.1", "Date - Copy.2"}),
#"Split Column by Delimiter1" = Table.SplitColumn(#"Split Column by Delimiter", "Date - Copy.2", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Date - Copy.2.1", "Date - Copy.2.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Date - Copy.1", type text}, {"Date - Copy.2.1", type datetime}, {"Date - Copy.2.2", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date", "Date - Copy.1", "Date - Copy.2.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Date - Copy.2.1", "Date"}})
in
#"Renamed Columns"
Click "Apply and Close" to adjust the formatting in the desktop table view.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Neeko Tang,
Thanks for the replay exactly i also did it the same way & it works but i was looking is there any way if we can do this in single column, but no worries thanks for the solution.