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.
You can do this in a calculated column if you prefer not to delve in to M.
The default unit in a Date/Time context is 1 day, so:
Column = [DateTimeCreated] + 1 in your example would return 2016-12-21 19:40
You can use this to add hours using decimals or a calculation like:
Column = [DateTimeCreated] + 0.5 (12 hours added)
Column = [DateTimeCreated] + ((1/24)*10) (10 hours added)
- Kuro7 years agoFrequent Visitor
It works! Amazing and thanks
Anonymous wrote:You can do this in a calculated column if you prefer not to delve in to M.
The default unit in a Date/Time context is 1 day, so:
Column = [DateTimeCreated] + 1 in your example would return 2016-12-21 19:40
You can use this to add hours using decimals or a calculation like:
Column = [DateTimeCreated] + 0.5 (12 hours added)
Column = [DateTimeCreated] + ((1/24)*10) (10 hours added)
!