Time round to nearest quarter

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hello,

I have a formula field called {@originaltime}
that has the following formula inside of it:
If isnull({CLOCK_IN_OUT.ORIGINAL_TIME_IN_OUT})
then Time({CLOCK_IN_OUT.TIME_IN_OUT})
else time({CLOCK_IN_OUT.ORIGINAL_TIME_IN_OUT})


and that generates a time of punch in for me

I would like to apply a time rounding rule to nearest quarter. but whether it rounds up or down is based of where within the quarter the time falls.
if it's within the first 7 minutes of the quarter, I need it to round DOWN, if it's after the 7 minutes, I need it to round UP.

Thank you!
I assume this is a datetime field and you need to possible round up to midnight on the following day.

probably need to take midnight for the same date, do a date diff between those to get the total minutes of the day, round using 15, then add that result back to the midnight date value