Solved

Hours minutes and seconds left

Posted on 2011-03-10
1
260 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

12 Experts available now in Live!

Get 1:1 Help Now