VBScript FormatDateTime 函式
❮ VBScript 參考大全
FormatDateTime 函式用於格式化並返回一個有效的日期或時間表達式。
語法
FormatDateTime(date,format)
引數 | 描述 |
---|---|
date | 必需。任何有效的日期表示式(例如 Date() 或 Now()) |
format | 可選。指定要使用的日期/時間格式的值 可取以下值
|
示例
示例
以不同格式顯示日期
<%
d=CDate("2019-05-31 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 />")
%>
上面程式碼的輸出將是
5/31/2019 1:45:00 PM
2019年5月31日,星期五
5/31/2019
1:45:00 PM
13:45
顯示示例 »
❮ VBScript 參考大全