VBScript TimeValue 函数

TimeValue 函数将给定的输入字符串转换为有效时间。

语法

TimeValue(StringTime) 

示例

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         document.write(TimeValue("20:30") & "<br />")
         document.write(TimeValue("5:15") & "<br />")
         document.write(TimeValue("2:30:58") & "<br />")

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

当您将其另存为 .html 并在 Internet Explorer 中执行时,上述脚本将产生以下结果 −

8:30:00 PM
5:15:00 AM
2:30:58 AM

vbscript_date.html