Dear i am facing a probelm to calculate the time between two times in asp i m using this code from your posted topic at forums
http://p2p.wrox.com/topic.asp?TOPIC_ID=45372 but dear problem is if a person login at 11/11/07 11:30PM and logout at 12/11/07 01:30AM the person has spent 2hrs but following code shows -23:00 how to correct this problem since it only occurs when there is a change of day
my code is below
Time_In=(rec("Time_In"))
Time_start_hour= Hour(time_in)
Time_start_min= Minute(time_in)
Time_finish_hour= Hour(time)
Time_finish_min= Minute(time)
'***************Time Calcultion ***************************
start_time = Time_start_hour &":"& time_start_min
finish_time = Time_finish_hour &":"& Time_finish_min
'Min_Diff = DateDiff("n", Finish_time, Start_time)
response.write(min_diff)
'finish_time = time
' Check if stop minutes are more than start minutes
If (Time_finish_min > Time_start_min) then
Time_total_min= Time_finish_min- Time_start_min
Time_total_hour= Time_finish_hour- Time_start_hour
Else
Time_total_min= (Time_finish_min + 60)- Time_start_min
Time_total_hour= (Time_finish_hour-1)- Time_start_hour
end if
Thanks
Waiting your reply
Adil Irshad.