View Full Version : Time Calculation.

08-10-2004, 05:05 AM

How to calculate Time in ASP, i have a senario is to calculate employee's working hours.

my source data is :
1/7/2004 : TimeIn :08:00am; BreakOut:12:00pm; BreakIn:13:00pm; TimeOut: 18:00pm
2/7/2004 : TimeIn :09:00am; BreakOut:12:30pm; BreakIn:13:12pm; TimeOut: 17:09pm

so i need to calculate the total working hours for the employee, then minus the fixed working hours 8 hours per day=248hrs i will get the OT hours. but when i do calculation i might get 233.92, it suppose not appear 233.92 it should be sown 234.32(234 hrs 32 mins)

i try to use Hourformat but i wha ti get is the timeStamp like 04 :47...

08-10-2004, 05:42 AM
Use the DateDiff (http://www.devguru.com/Technologies/vbscript/quickref/datediff.html) function, it can also be used for times.

diff = datediff("N","9:00am","10:00am")
response.write diff

08-10-2004, 06:02 AM
glenngv knows what he is talking about.

Here's some tutorials: http://www.aspin.com/func/search?hidden1x=15&hidden1y=14&tree=aspin&qry=datediff&cat=tu