/ Published in: ASP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Function TimeAgo(dtField) days = DateDiff("d", dtField, Now) If days > 365 Then years = DateDiff("yyyy", dtField, Now) If years = 1 Then ago = "Expired " & years & " year ago" Else ago = "Expired " & years & " years ago" End If ElseIf days > 30 Then months = DateDiff("m", dtField, Now) If months = 1 Then ago = "Expired " & months & " month ago" Else ago = "Expired " & months & " months ago" End If Else ago = "Expired " & days & " days ago" End If TimeAgo = ago End Function