Solved

Crystal Reports Round time to nearest Quarter

Posted on 2014-07-29
3
806 Views
Last Modified: 2014-07-30
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
Comment
Question by:BKennedy2008
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
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))

Open in new window


mlmcc
0
 

Author Closing Comment

by:BKennedy2008
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now