ASP Vbscript Hour Function

Updated on 23 Feb 2012,
Published on 13 Aug 2008

In classic ASP, Vbscript Hour function of time functions series returns a number value as hour of the day. Value returned by the vbscript hour function represents the hour of the day retrieved from the specified time value. Vbscript Hour function returns the value between 0 and 23 that represents the 24 hours in a day. 0 to 11 hours denote AM time i.e. ante meridiem (before noon). 12 to 23 hours represent after noon and evening time i.e. PM post meridiem.

Classic ASP VbScript Time Functions Examples:

You can see the live samples and examples of Classic ASP VbScript Time functions from the following links:

Syntax for ASP Vbscript Hour Function

Hour(time)

Vbscript Hour function accepts only 1 parameter as time type or string value having supported time format e.g.: hh:mm tt, hh:mm:ss tt. You can also pass the combination of date time value to the vbscript Hour function e.g.: mm/dd/yyyy hh:mm:ss tt.

Examples of Vbscript Hour Function in ASP

<%
Response.Write(Hour(Now))

Response.Write(Hour(Time))

Response.Write(Hour("10:30 AM"))

Response.Write(Hour("10:30 PM"))

Response.Write(Hour("10:30"))

Response.Write(Hour("23:30"))
%>

Output:

You can see the output of above discussed code from the following link:

VbScript Hour Function

Continue to next tutorial: ASP Vbscript Minute Function to learn how to get the minutes value from the specified time value.

0 Responses to "ASP Vbscript Hour Function"
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email
  • HIRE EzineASP.Net Developers