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 |
---|---|
43 | |
29 | |
25 | |
23 | |
13 |