Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%
- Function TimeSpan(dt1, dt2)
- If (isDate(dt1) And IsDate(dt2)) = false Then
- TimeSpan = "00:00:00"
- Exit Function
- End If
- seconds = Abs(DateDiff("S", dt1, dt2))
- minutes = seconds 60
- hours = minutes 60
- minutes = minutes mod 60
- seconds = seconds mod 60
- if len(hours) = 1 then hours = "0" & hours
- TimeSpan = hours & ":" & _
- RIGHT("00" & minutes, 2) & ":" & _
- RIGHT("00" & seconds, 2)
- End Function
- d1 = "2002-03-27 9:20:25 AM"
- d2 = "2002-03-27 9:20:45 AM"
- Response.Write TimeSpan(d1, d2)
- %>
- <%
- Function TimeSpan(dt1, dt2)
- If (isDate(dt1) And IsDate(dt2)) = false Then
- TimeSpan = "00:00:00"
- Exit Function
- End If
- seconds = Abs(DateDiff("S", dt1, dt2))
- minutes = seconds 60
- hours = minutes 60
- days = hours 24
- minutes = minutes mod 60
- seconds = seconds mod 60
- hours = hours mod 24
- if len(hours) = 1 then hours = "0" & hours
- TimeSpan = days& ":" & _
- RIGHT("00" & hours , 2) & ":" & _
- RIGHT("00" & minutes, 2)
- End Function
- d1 = "2002-03-27 9:20:25 AM"
- d2 = "2002-03-27 9:20:45 AM"
- Response.Write TimeSpan(d1, d2)
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement