VBScript HourFunction
Complete VBScript Reference Manual
The Hour function returns a number from 0 to 23 that represents the hour of the day.
Syntax
Hour(time)
| Parameter | Description |
|---|---|
| time | Required. Any expression that can represent a time. |
Examples
Example 1
<script type="text/vbscript">
document.write(Hour("13:45"))
</script>
document.write(Hour("13:45"))
</script>
The output of the above example is:
13
Try it yourself »
Example 2
<script type="text/vbscript">
document.write(Hour(Now()))
</script>
document.write(Hour(Now()))
</script>
The output of the above example is:
document.write(Hour(Now()))
Try it yourself »
Complete VBScript Reference Manual Other Extensions