Forum Discussion
Anonymous
9 years agoNot applicable
How to add hours to DateTime data?
I have a column DateTimeCreated (Example: 2016-12-20 19:40) and I want to add 10 hours to this resulting in 2016-12-21 05:40. Is this possible?
- 9 years ago
You can add a duration to a datetime field, e.g. if your fieldname is "DateTime":
[DateTime] + #duration(0,10,0,0))
The arguments of#duration are days, hours, minutes, seconds.
MarcelBeug
9 years agoCommunity Champion
In the code below I copied your line without any modification and it works fine.
let
Source = {40000..40001},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "adx_releasedate"}}),
adx_events = #"Renamed Columns"{0},
StartDate = (adx_events[adx_releasedate] + #duration(0,10,0,0))
in
StartDate
You can copy/paste this code into your query editor and see for yourself.
rohit01
8 years agoFrequent Visitor
Thansk a lot, your solution worked magically for my issue as well :)