VBScript TimeSerial Function


Advertisements

The TimeSerial function returns the time for the specified hour, minute and second values.

Syntax

TimeSerial(hour,minute,second) 

Parameter Description

  • Hour, a Required parameter, which is an integer between 0 and 23 or any numeric expression.

  • Minute, a Required parameter, which is an integer between 0 and 59 or any numeric expression.

  • Second, a Required parameter, which is an integer between 0 and 59 or any numeric expression.

Example

<!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>

When you save it as .html and execute it in Internet Explorer, then the above script will produce the following result −

8:01:02 PM
12:59:59 AM
2:20:18 PM
vbscript_date.htm
Advertisements