VBScript CDate 函式



該函式將有效的日期和時間表達式轉換為 date 型別。

語法

cdate(date)

示例

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         a = cdate("Jan 01 2020")
         document.write("The Value of a : " & a)
         document.write("<br />")
         b = cdate("31 Dec 2050")
         document.write("The Value of b : " & b)

      </script>
   </body>
</html>

在 Internet Explorer 中將該指令碼儲存為 .html 格式並執行之後,它將產生以下結果 −

The Value of a : 1/01/2012
The Value of b : 31/12/2050 
vbscript_date.htm
廣告
© . All rights reserved.