Thursday, April 2, 2009

Current date format in ASP

The Format Date Time function takes two arguments: a date and (optional) an integer from 0 through 4. The meanings of these numbers are as follows:

0 - This is the default setting. A short date DD/MM/YYYY will be used.
1 - A long date defined by the computer's regional settings.
2 - A short date defined by the regional settings.
3 - (time)A time using the time format defined by the regional settings.
4 - (time)A time using military time HH:MM (H = hour, M = Minute)

OUTPUT :
0 = 4/2/2009
1 = Friday, October 21, 2005
2 = 4/2/2009
3 = 12:00:00 AM
4 = 00:00

Type 1.
CurrentDate=FormatDateTime(Date, 0)
Response.Write(CurrentDate)

OutPut : 4/2/2009


Type 2.
CurrentDate=FormatDateTime(Date, 1)
Response.Write(CurrentDate)

OutPut : Thursday, April 02, 2009

No comments: