Google

Sunday, January 13, 2008

Vb Script Tutorial

10.7 DateSerial
The DateSerial function returns a Variant of subtype Date for a specified year, month, and day.
Syntax
DateSerial(year,month,day)

Parameter
Description
year
Required. A number between 100 and 9999, or a numeric expression. Values between 0 and 99 are interpreted as the years 1900–1999. For all other year arguments, use a complete four-digit year
month
Required. Any numeric expression
day
Required. Any numeric expression
Example 1
document.write(DateSerial(1996,2,3) & "
")document.write(DateSerial(1990-20,9-2,1-1))Output:2/3/19966/30/1970
10.8 DateValue
The DateValue function returns a Variant of subtype Date.
Note: If the year part of date is omitted this function will use the current year from the computer's system date.
Note: If the date parameter includes time information it will not be returned. However, if date includes invalid time information, a run-time error will occur.
Syntax
DateValue(date)

Parameter
Description
date
Required. A date from January 1, 100 through December 31, 9999 or any expression that can represent a date, a time, or both a date and time
Example 1
document.write(DateValue("31-Jan-02") & "
")document.write(DateValue("31-Jan") & "
")document.write(DateValue("31-Jan-02 2:39:49 AM"))Output:1/31/20021/31/20021/31/2002
10.9 Day
The Day function returns a number between 1 and 31 that represents the day of the month.
Syntax
Day(date)

Parameter
Description
date
Required. Any expression that can represent a date
Example 1
document.write(Date & "
")document.write(Day(Date))Output:1/14/200214

No comments: