snowboardr
Programmer
My code seems to be buggy... i have no idea why its not returning the correct time ... its returning approx 17 hours... when the dats are 8/5 and 8/13
Army : Combat Engineer : 21B
Code:
<%
Function GetTime(aFirstDate,aSecondDate)
Dim t_min, t_hour, t_day
Dim GetTimeTmp
Dim sColor
If isDate(aFirstDate) then
t_min = DateDiff("n",aFirstDate, aSecondDate)
t_hour = Fix(t_min/60)
t_min = t_min mod 60
t_day = Fix(t_hour/24)
t_hour = t_hour mod 24
If t_hour > 0 Then GetTimeTmp = GetTimeTmp & t_hour & " hr"
If t_hour > 1 then
GetTimeTmp = GetTimeTmp & "s "
Else
GetTimeTmp = GetTimeTmp & " "
End If
If t_min > 0 Then GetTimeTmp = GetTimeTmp & t_min & " min"
If t_min > 1 then
GetTimeTmp = GetTimeTmp & "s "
Else
GetTimeTmp = GetTimeTmp & " "
End If
If Len(GetTimeTmp) > 0 Then GetTimeTmp = Left(GetTimeTmp,Len(GetTimeTmp)-1)
GetTimeTmp = GetTimeTmp & " ago"
If trim(GetTimeTmp) = "ago" then
GetTimeTmp = "Less than 1 minute..."
scolor = "newpost"
Else
If instr(GetTimeTmp,"hrs") = 0 then
scolor = "newpost"
Else
scolor = "q_values"
End iF
End If
GetTime = "<span class='" & sColor & "'>" & GetTimeTmp & "</span>"
End If
End Function
Army : Combat Engineer : 21B