Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have the time in this format 14/10/2012 5:00:00 +02:00, but I would like to show this 14/10/2012 7:00:00, can you help me?
Thank´s a lot
Solved! Go to Solution.
Hello @kingkike
if this is a text string, you can do that with some Text.Split and DateTime.From and Duration.From. Here a practical example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTRNzTQNzIwNFIwtTIwACIFbQMjIKUUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each DateTime.From(Text.Split([Column1],"+"){0}) + Duration.From(Text.Split([Column1],"+"){1}))
in
#"Added Custom"
but I think that your data is a DateTimeZone-format, meaning +2 is CET-time zone and with this data adding +2 hours makes no logic, but then it would make sense to change the zone. Here the above example applying SwitchZone
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTRNzTQNzIwNFIwtTIwACIFbQMjIKUUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each DateTime.From(Text.Split([Column1],"+"){0}) + Duration.From(Text.Split([Column1],"+"){1})),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each DateTimeZone.SwitchZone(DateTimeZone.From([Column1]),4))
in
#"Added Custom1"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @kingkike
if this is a text string, you can do that with some Text.Split and DateTime.From and Duration.From. Here a practical example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTRNzTQNzIwNFIwtTIwACIFbQMjIKUUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each DateTime.From(Text.Split([Column1],"+"){0}) + Duration.From(Text.Split([Column1],"+"){1}))
in
#"Added Custom"
but I think that your data is a DateTimeZone-format, meaning +2 is CET-time zone and with this data adding +2 hours makes no logic, but then it would make sense to change the zone. Here the above example applying SwitchZone
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTRNzTQNzIwNFIwtTIwACIFbQMjIKUUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each DateTime.From(Text.Split([Column1],"+"){0}) + Duration.From(Text.Split([Column1],"+"){1})),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each DateTimeZone.SwitchZone(DateTimeZone.From([Column1]),4))
in
#"Added Custom1"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
thank´s so much Jimmy
Best regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.