10.10 FormatDateTime
The FormatDateTime function formats and returns a valid date or time expression.
Syntax
FormatDateTime(date,format)
Parameter
Description
date
Required. Any valid date expression (like Date() or Now())
format
Optional. A Format value that specifies the date/time format to use
Example 1
document.write("The current date is: ")document.write(FormatDateTime(Date()))Output:The current date is: 2/22/2001
10.11 Hour
The Hour function returns a number between 0 and 23 that represents the hour of the day.
Syntax
Hour(time)
Parameter
Description
time
Required. Any expression that can represent a time
Example 1
document.write(Now & "
")document.write(Hour(Now))Output:1/15/2002 10:07:47 AM10
10.12 IsDate
The IsDate function returns a Boolean value that indicates if the evaluated expression can be converted to a date. It returns True if the expression is a date or can be converted to a date; otherwise, it returns False.
Note: The IsDate function uses local setting to determine if a string can be converted to a date ("January" is not a month in all languages.)
Syntax
IsDate(expression)
Parameter
Description
expression
Required. The expression to be evaluated
Example 1
document.write(IsDate("April 22, 1947") & "
")document.write(IsDate(#11/11/01#) & "
")document.write(IsDate("#11/11/01#") & "
")document.write(IsDate("Hello World!"))Output:TrueTrueFalseFalse
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment