AnsweredAssumed Answered

Best way to calculate time

Question asked by gpgrieco on Jun 20, 2012
Latest reply on Jun 20, 2012 by philmodjunk

Title

Best way to calculate time

Post

I am creating a system to create and print rental agreements. I have: Date Out, Date In, Time Out, and Time In. Now this is the script I've created that triggers on object exit for all four of those fields.

if [IsEmpty ( Invoices::Date Out ) or IsEmpty ( Invoices::Date In ) or IsEmpty ( Invoices::Time Out ) or IsEmpty ( Invoices::Time In )]

Set Field [Invoices::Actual Days; 0]

Exit Script []

Else

Set Field [Invoices::Actual Days; Invoices::Date In - Invoices::Date Out]

End If

 

Now this will give me a number as to how many days they have had the item. Now what I'm trying to do is check the time in and out because I need to make sure that 1 day is being charged as 24 hours (Pickup at 9AM today and return at 9AM tomorrow would be one day, return at noon tomorrow would be two days), but with 1 hour grace period. What would be the best way to do this? Or any way really. Everything I have tried isn't working.

Outcomes