Solved

Crystal Reports Round time to nearest Quarter

Posted on 2014-07-29
3
922 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
[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
  • Learn & ask questions
  • 2
3 Comments
 
LVL 100

Expert Comment

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

Accepted Solution

by:
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))

Open in new window


mlmcc
0
 

Author Closing Comment

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Basic Crystal Report not showing up on ASP.NET page 4 123
A string is required here error 20 33
Crystal Reports 7 VB6  'Feature Not Enabled' Error 10 42
Timezone help 5 45
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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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