Forum Discussion
How to add hours to DateTime data?
- 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.
Same here.. that #Duration formula doesn't works
#duration is a Power Query (M) function to be used in the Query Editor.
And it is case-sensitive, so #Duration won't work in any case.
- rtrenado9 years agoRegular Visitor
Sorry, i write Duration here, but i tried with duration as follows:
StartDate = (adx_events[adx_releasedate] + #duration(0,10,0,0))
i get this error on powerbi query editor:
The following syntax error occurred during parsing: Invalid token, Line 1, Offset 32, #.
- MarcelBeug9 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 StartDateYou can copy/paste this code into your query editor and see for yourself.
- quinncallan9 years agoNew Member
Hi
How do you add 10hrs to all dates in the list instead of just one?
- DavePx4 years agoFrequent Visitor
Worth mentioning in the answer as Power Query M is not mentioned in the question either.
This is first Google result for "powerbi date add hours".
Most people would be expecting DAX