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!

Calculating hourly difference

Status
Not open for further replies.

mmorala

MIS
Aug 18, 2003
14
US
Hi,
I am trying to calculate the time between two fields in a ticket database, [RECEIVEDDATE] and [COMPLETEDDATE].

This is my formula:

Local DateTimeVar d1 := {TICKET.RECEIVEDDATE};
Local DateTimeVar d2 := {TICKET.COMPLETEDDATE};

DateDiff ("h", d1, d2) -
DateDiff ("ww", d1, d2, crSaturday) -
DateDiff ("ww", d1, d2, crSunday)

Would this formula work? Is there another way I could do this that would be more efficient and accurate?

Thanks,
Michael
 
It will work if you convert your weekends to hours. Currently they are days;

DateDiff ("h", d1, d2) -
DateDiff ("ww", d1, d2, crSaturday)*24 -
DateDiff ("ww", d1, d2, crSunday)*24


Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top