Hi guys,
if we do [Datetime field] + “002:00:00”, it results in 2 hours after that datetime. Great !
But I need to add a variable number of hours. I tried to use CONCATENATE to mount a string in place of “002:00:00” but it didn’t work.
It worked when I used DATETIME function to brake down all parts and rejoin it, like this: DATETIME(CONCATENATE(TEXT(DATE([Start]),“MM/DD/YYYY”)," ",TEXT(TIME([Start])+[Hours],“HH:MM:SS”)))
But I guess there should be a more simple and direct way…
Thanks for any help !
Date / Time / Duration computations are typically complex and lengthy.
Your post’s title says “Add a variable hour/ minute” but your shared expression only adds [Hours] .
Could you clarify?
Assuming you only wish to add [Hours], the expression you have shared will not roll over the date into the next date. For example, if 21 hours are added to a date time of “17/11/2021, 08:41:16 am” , it should actually calculate the result to “18/11/2021, 05:41:16 am” but the expression you shared will calculate it as “17/11/2021, 05:41:16 am” that is, it will compute without date change.
If you wish to incorporate date change as well when it is expected to, please try the following expression
[Start]+ (TIME([Hours]&":00:00")-“00:00:00”)
Hi @Suvrutt_Gurjar , in fact, I mentioned hour/minute, but I really need add only hours in this moment. Thanks for your alert about rolling over into the next date and, of course, for your more clean solution. Best !
For reference:
User | Count |
---|---|
41 | |
30 | |
29 | |
16 | |
14 |