Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total Time

Status
Not open for further replies.

DragonRider2

Technical User
Apr 14, 2003
2
US
I am using MS Access to record Start Time(Stime) and End Time(etime). Using Crystal report how can I get it to tell me the time it took to do something?

Ex.
Date Start Time End Time Total Time?
1/10/2003 8:30:00am 9:15:12am

 
What are the data types, date/time? If not, I suggest you make them datetime.

How do you want the result demonstrated, in HH:MM:SS, or just minutes, or???

You can convert the difference using datediff, as in:

datediff("s",etime,stime)

So to display it in HH:MM:SS, try something like the following in a formula:

numberVar dur:=datediff("s",etime,stime);
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");

hhmmss

-k
 
In this report I hope to use the HH:MM:SS format. In different reports I need to use just the SS.

This is the first time I am trying to use Crystal Report and I just bought a copy of Dummies for ... Not to sound to dumb, but where do I add the script you mention?
 
Create a formula (Insert Field Object->Right Click Formula Fields->New), and place it in the Details section.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top