Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hours minutes and seconds left

Posted on 2011-03-10
1
Medium Priority
?
274 Views
Last Modified: 2012-05-11
I want to display the days, hours and minutes between two dates using a Crystal reports formula but am unsure on how to do this. Can this be done using either basic of Crystal syntax?
0
Comment
Question by:JayceW
[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
1 Comment
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 35095865
It can be done in either syntax.  Here it is in Crystal

Local NumberVar TotalSeconds;
Local NumberVar HoursLeft;
Local NumberVar MinutesLeft;
Local NumberVar DaysLeft;

TotalSeconds := DateDiff('s',{StartDateTime},{EndDateTime});
DaysLeft := TotalSeconds \ (60*60*24);
TotalSeconds  := TotalSeconds mod (60*60*24);
HoursLeft := TotalSeconds \ (60 * 60);
TotalSeconds := TotalSeconds mod (60 * 60);
MinutesLeft := TotalSeconds \ 60;
TotalSeconds := TotalSeconds  mod 60;

CStr(DaysLeft ,0) & " days  " & CStr(HoursLeft ,0) & ":" & CStr(MinutesLeft,0) & ":" CStr(TotalSeconds  ,0)

mlmcc

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

715 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