formatdateTime()

formatdateTime()函式返回表達式,此表達式已被格式化為日期或時間。

formatdateTime()函式返回表達式,此表達式已被格式化為日期或時間
表達式 formatdateTime(Date, [, Namedformat])
允許數據類型: Namedformat 指示所使用的日期/時間格式的數值,如果省略,則使用 vbGeneralDate.
NamedFormat參數的設定值如下:
常數 值 描述
vbGeneralDate 0 顯示日期和/或時間。如果有日期部分,則用短日期格式顯示。如果有時間部分,則用長時間格式顯示。如果都有,兩部分都顯示。
vbLongDate 1 用計算機區域設定值中指定的長日期格式顯示日期。
vbShortDate 2 用計算機區域設定值中指定的短日期格式顯示日期。
vbLongTime 3 用計算機區域設定值中指定的時間格式顯示時間。
vbShortTime 4 用24小時格式(hh:mm)顯示時間。
實例: <%=formatdateTime("09/9/00", vbLongDate)%>
返回結果: Sunday, September 09, 2000
例如:高考倒計時
<%@ Language=VBScript %>
<html>
<title>
倒記時間
</title>
<body>
<%
response.write "今天是"
response.write formatDateTime(Date(),1) & ","
'格式化為長日期格式輸出顯示
response.write " 離高考還有"
response.write "<font color=blue><u>"
'調用DateDiff函式,計算日期間隔.
response.write DateDiff("d",Date(),"10-06-07")
response.write "</u></font>"
response.write "天"
%>
</body>
</html>

相關詞條

熱門詞條

聯絡我們