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!

Duration between start datetime and current date\time 1

Status
Not open for further replies.

Waremark

IS-IT--Management
Jan 15, 2003
2
GB
I am trying to calculate how long a helpdesk call has been open. I need to subtract the current date\time from the log date\time and show the difference in days, hours, minutes but I cannot find a formula that does this. I am using crystal reports version 7
 
Something like this:

numberVar dur := datediff('s',{Orders.Order Date},currentdatetime);
numbervar days;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

days := int((Truncate(Truncate(dur/60)/60))/24);
hrs := remainder(Truncate(Truncate(dur/60)/60),24);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

//hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00.0", 1);
hhmmss := "days:"+totext(days, "0") +" "+ totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");

hhmmss

I winged it, but that should get you very close.

-k kai@informeddatadecisions.com
 
Thanks, one thing though, I don't have the Datediff formula, how do I get this, is it a DLL that I need to ontain?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top