Print Page | Close Window

Time round to nearest quarter

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22659
Printed Date: 18 Apr 2024 at 4:02pm


Topic: Time round to nearest quarter
Posted By: Beso90
Subject: Time round to nearest quarter
Date Posted: 15 Aug 2018 at 12:38pm
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!



Replies:
Posted By: DBlank
Date Posted: 21 Aug 2018 at 4:32am
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



Print Page | Close Window