Solved

Hours minutes and seconds left

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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. …
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 …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 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