ASP has a number of commands relating to representing the date and time. Listed below are some of them, together with a description.
date()
Output is like: 17/2/2003 (format of the date will be dependant upon the settings of the server)
now()
Output is like: 17/2/2003 1:28:18 PM (format of the date will be dependant upon the settings of the server)
Day(dateValue)
Returns the day number.
WeekDayName(Day(dateValue))
Returns the name of the specified day.
Month(dateValue))
Returns the month number.
MonthName(Month(dateValue))
Returns the month name.
Year(dateValue)
Returns the year part of the date.
Over-ruling Server Settings
We are able to over-rule the server settings to specify the format in which the date will be presented. A number of these are illustrated below:
Session.LCID = 0413
results in dd/mm/yyyy format
FormatDateTime(date(), vbGeneralDate)
17/2/03 12:12:38 PM
FormatDateTime(curDate, vbLongDate)
Monday, 17 February , 2003
FormatDateTime(curDate, vbShortDate)
17/2/03
FormatDateTime(curDate, vbLongTime)
12:12:38 PM
FormatDateTime(curDate, vbShortTime)
12:12