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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date difference in hh.mm.ss

Status
Not open for further replies.

ipazzo

Programmer
Jan 17, 2002
69
IT
I have two filed a start date/time "hbeg" and an end date/time "hend".
Is there a way to use a formula to have the difference in the hh.mm.ss format?

Thanks for any suggestion.
 
The simplest way would be to download the DateTimeDiff UFL from Crystal's support site and use that.

Alternatively, use a formula like the following:

WhilePrintingRecords;
NumberVar SecondsDiff := DateDiff('s',{hbeg},{hend});
NumberVar Hours;
NumberVar Mins;
NumberVar Secs;

Hours := truncate(secondsdiff/3600);
Mins := truncate(((SecondsDiff/3600) - Hours)*60);
Secs := truncate(((((SecondsDiff/3600) - Hours)*60) - Mins)*60);

ToText(Time(Hours,Mins,Secs),"hh:mm:ss");

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top