Hi I have a workflow that generates certain columns using DateTimeNow(). However, I need to truncate the seconds into the nearest minute adding another formula tool. Can anyone tell me how to do that?
For example, In the attachment,
I want the Effective Start Date to be rounded to 2023-04-11 16:45 instead of 2023-04-11 16:45:02
Solved! Go to Solution.
How about DateTimeFormat(DateTimeNow(),”%Y-%m-%d %H:%M:00”) ?
you could also replace the date time now part with your already calculated columns
Added a check to see if it is before / after the half of the current minute, to get the "nearest minute".
Formula
isRoundUp = DateTimeSeconds([DateTime]) >=30
RoundDown = DateTimeFormat([DateTime],"%Y-%m-%d %H:%M:00")
RoundUp = DateTimeAdd([RoundDown],1,"minutes")
Result = IF [isRoundUp] THEN [RoundUp] ELSE [RoundDown] ENDIF
Output
I hope this works for your case.
thanks man