Sub DateDiff (units, dt1, dt2)
If units="d" Then
DateFormat ("mm/dd/yyyy")
x=DateParse(dt1)
y=DateParse(dt2)
Return (y-x) / cTicksPerDay
End If
If units="h" Then
TimeFormat("HH:mm")
x=TimeParse(dt1)
y=TimeParse(dt2)
Return (y-x) / cTicksPerHour
End If
If units="m" Then
TimeFormat("HH:mm")
x=TimeParse(dt1)
y=TimeParse(dt2)
Return (y-x) / cTicksPerMinute
End If
If units="s" Then
TimeFormat ("HH:mm:ss")
x=TimeParse(dt1)
y=TimeParse(dt2)
Return (y-x) / cTicksPerSecond
End If
End Sub
End Sub