TimeValue Function

Tips >>ASP Functions

The TimeValue function returns a Variant of subtype Date that contains the time. If the time argument contains date information, TimeValue doesn't return the date information. The String argument must be a string in valid date format or you will get an error message. However, if time includes invalid date information, an error occurs. The time argument is usually a string expression representing a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive. However, time can also be any expression that represents a time in that range. If time contains Null, Null is returned. You can enter valid times using a 12-hour or 24-hour clock. For example, "2:24PM" and "14:24" are both valid time arguments. If the time argument contains date information, TimeValue doesn't return the date information. However, if time includes invalid date information, an error occurs.

The Syntax of the TimeValue function is :-

TimeValue(time)

Its Description is :-

Parameter Description
time Required. A time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.) or any expression that represents a time in that range

Example#1 :-

Code :-
document.write(TimeValue("5:55:59 PM") & "<br />")
document.write(TimeValue(#5:55:59 PM#) & "<br />")
document.write(TimeValue("15:34"))
Output :-
5:55:59 PM
5:55:59 PM
3:34:00 PM

Example#2 :-

Code :-
document.write(TimeValue("4:35:17 PM") & "<br />")
Output :-
4:35:17 PM.

Example#3 :-

Code :-
document.write(TimeValue("2:23:17 PM") & "<br />")
Output :-
2:23:17 PM

Example#4 :-

Code :-
document.write(TimeValue("14:23") & "<br />")
Output :-
2:23:00 PM

Example#5 :-

Code :-
document.write(TimeValue("4:35:17") & "<br />")
Output :-
4:35:17 PM

 

 

 
E-mail : sales at virtualsplat dot com

Phone : +91 022 28067978