get today date string


/ Published in: ASP
Save to your folder(s)

gets you a date string for today in YearMonthDay formant like this 20100917


Copy this code and paste it in your HTML
  1. Function getTodayDateString
  2. dim thisYear, thisMonth, thisDay, dateString
  3.  
  4. thisYear = cstr(year(date))
  5. thisMonth = cstr(month(date))
  6. thisDay = cstr(day(date))
  7.  
  8. If len(thisMonth) = 1 Then
  9. thisMonth = "0" & thisMonth
  10. End If
  11.  
  12. If len(thisDay) = 1 Then
  13. thisDay = "0" & thisDay
  14. End If
  15.  
  16. dateString = thisYear & thisMonth & thisDay
  17. getTodayDateString = dateString
  18. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.