Solved

Hours minutes and seconds left

Posted on 2011-03-10
1
263 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
1 Comment
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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. …
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A short film showing how OnPage and Connectwise integration works.

919 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

23 Experts available now in Live!

Get 1:1 Help Now