Return to Snippet

Revision: 11820
at February 19, 2009 18:20 by joeydi


Initial Code
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

Initial URL

                                

Initial Description

                                

Initial Title
TimeAgo Function

Initial Tags
date, function

Initial Language
ASP