# Crystal Reports Round time to nearest Quarter

I have a DateTime Var  that I need to round to the nearest quarter.
7:19 AM, round to 7:15 am,.......Normal rounding rules for time values.
If I need to convert to decimal time, then round, and change back to normal time, not sure how to go about that, if you could help.
Thanks
###### Who is Participating?

Commented:
Here is a formula that does it without converting to minutes

``````If Minute({Sheet1_.Time on}) <= 7 then
DateTime(Date({Sheet1_.Time on}), Time(Hour({Sheet1_.Time on}),0,0))
Else If Minute({Sheet1_.Time on}) <= 22 then
DateTime(Date({Sheet1_.Time on}), Time(Hour({Sheet1_.Time on}),15,0))
Else If Minute({Sheet1_.Time on}) <= 37 then
DateTime(Date({Sheet1_.Time on}), Time(Hour({Sheet1_.Time on}),30,0))
Else If Minute({Sheet1_.Time on}) <= 52 then
DateTime(Date({Sheet1_.Time on}), Time(Hour({Sheet1_.Time on}),45,0))
Else
DateTime(Date({Sheet1_.Time on}), Time(Hour({Sheet1_.Time on}),0,0))
``````

mlmcc
0

Commented:
You could convert the time to minutes then round using a formula like below then convert back to time

Round ( {database.field} / 4, 0 ) * 4

You can also create a formula that tests for intervals in the minutes and rounds the time.

mlmcc
0

Author Commented:
Thanks again- You have been a time-saver for sure for not re-creating the wheel!
I basically used your formulas without converting into my report with small modifications.
Thanks Again-
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.