Revision: 6876
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2008 19:20 by corydeppen
Initial Code
Function whenCreated(dtmCreated As Date) As String Dim lngHoursDiff As Long Dim lngDaysDiff As Long Dim lngWeeksDiff As Long Dim lngMonthsDiff As Long lngHoursDiff = Abs(DateDiff("h", Date, dtmCreated)) lngDaysDiff = Abs(DateDiff("d", Date, dtmCreated)) lngWeeksDiff = Abs(DateDiff("ww", Date, dtmCreated)) lngMonthsDiff = Abs(DateDiff("m", Date, dtmCreated)) Select Case lngHoursDiff Case Is < 24 whenCreated = lngHoursDiff & " hours ago" Case Is < 48 whenCreated = "Yesterday" Case Else Select Case lngDaysDiff Case Is < 7 whenCreated = lngDaysDiff & " days ago" Case Is < 14 whenCreated = "Last week" Case Else Select Case lngMonthsDiff Case 0 whenCreated = lngWeeksDiff & " weeks ago" End Select End Select End Select End Function
Initial URL
Initial Description
Initial Title
How long ago did something occur
Initial Tags
Initial Language
Visual Basic