Solved

# Crystal Reports Round time to nearest Quarter

Posted on 2014-07-29
956 Views
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
0
Question by:BKennedy2008
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 101

Expert Comment

ID: 40227595
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

LVL 101

Accepted Solution

mlmcc earned 500 total points
ID: 40227700
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

Author Closing Comment

ID: 40229875
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
###### Suggested Courses
Course of the Month7 days, 3 hours left to enroll