ASP Vbscript TimeValue Function

Updated on 23 Feb 2012,
Published on 10 Aug 2008

ASP vbscript TimeValue function returns the time part from the specified date and time value. Vbscript TimeValue function returns only time formatted as hh:mm tt whether the value passed to the TimeValue function contains combination of date and time both e.g.: 8/10/2008 11:10 AM.

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 Vbscript TimeValue Function

TimeValue(time)

Vbscript TimeValue function accepts only 1 parameter as date time type or string value having supported date time format. E.g: mm/dd/yyyy; mmm dd, yyyy; mmmm dd, yyyy; dd mmm, yyyy; dd mmmm, yyyy. Each format must have formatted time also at the end of date formatted separated from date with a single white space character e.g.: mm/dd/yyyy hh:mm tt. You can also specify the time value only in the format such as hh:mm tt, HH:mm tt.

Examples for Vbscript TimeValue function in ASP

<%
Response.Write(Now)

Response.Write(TimeValue(Now))

Response.Write(TimeValue("August 10, 2008 11:10 PM"))

Response.Write(TimeValue("10:00 PM"))

Response.Write(TimeValue("10:00"))

Response.Write(TimeValue("15:00"))
%>

Output:

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

VbScript TimeValue Function

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

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