Advertisement
Guest User

Skynet Solutions - getS Function Definition

a guest
Jan 23rd, 2012
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 0.92 KB | None | 0 0
  1. <%
  2. ''
  3. '    A basic copy of PHP's version of date('S')
  4. '    "English ordinal suffix for the day of the month, 2 characters"
  5. '    @param int day The day suffix you are looking for.
  6. '    @return st ring This is the suffix you were looking for.
  7. ''
  8. Function getS(fn_day)
  9.  
  10.     If fn_day = "" Then
  11.         fn_day = CStr(DAY(NOW()))
  12.     Else
  13.         fn_day = CStr(CInt(fn_day))
  14.     End If
  15.    
  16.     fnll = Mid(fn_day, len(fn_day), 1)
  17.     If len(fn_day) = 1 Then
  18.         fndl = -1
  19.     Else
  20.         fndl = Mid(fn_day, len(fn_day)-1, 2)
  21.     End If
  22.    
  23.     If fndl >= 11 AND fndl <= 13 Then
  24.         getS = "th"
  25.         Exit Function
  26.     ElseIf fnll = 1 Then
  27.         getS = "st"
  28.         Exit Function
  29.     ElseIf fnll = 2 Then
  30.         getS = "nd"
  31.         Exit Function
  32.     ElseIf fnll = 3 Then
  33.         getS = "rd"
  34.         Exit Function
  35.     Else
  36.         getS = "th"
  37.         Exit Function
  38.     End If
  39. End Function
  40. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement