< Complete VBScript Reference
The FormatDateTime function formats and returns a valid date or time expression.
Syntax
FormatDateTime(date,format)
Parameter | Description |
---|---|
date | Required. Any valid date expression (like Date() or Now()) |
format |
Optional. A value that specifies the date/time format to use
Can take the following values:
|
Example
Example
Display a date in different formats:
<%
d=CDate("2010-02-16 13:45")
response.write(FormatDateTime(d) & "<br />")
response.write(FormatDateTime(d,1) & "<br />")
response.write(FormatDateTime(d,2) & "<br />")
response.write(FormatDateTime(d,3) & "<br />")
response.write(FormatDateTime(d,4) & "<br />")
%>
The output of the code above will be:
2/16/2010 1:45:00 PM
Tuesday, February 16, 2010
2/16/2010
1:45:00 PM
13:45
Show Example »
< Complete VBScript Reference