當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


VBScript TimeSerial用法及代碼示例


TimeSerial 函數返回指定小時、分鍾和秒值的時間。

用法

TimeSerial(hour,minute,second) 

參數說明

  • 小時,必需參數,它是 0 到 23 之間的整數或任何數值表達式。

  • 分鍾,必需參數,它是 0 到 59 之間的整數或任何數值表達式。

  • 其次,一個必需參數,它是 0 到 59 之間的整數或任何數字表達式。

示例

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         document.write(TimeSerial(20,1,2) & "<br />")
         document.write(TimeSerial(0,59,59) & "<br />")
         document.write(TimeSerial(7*2,60/3,15+3)& "<br />")

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

當你將它保存為 .html 並在 Internet Explorer 中執行它時,那麽上麵的腳本將產生以下結果——

8:01:02 PM
12:59:59 AM
2:20:18 PM

相關用法


注:本文由純淨天空篩選整理自 VBScript TimeSerial Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。