The DateSerial function returns a date that is generated from the specified year, month, and day numbers.
Syntax | ||||
DateSerial(YearNumber, MonNumber, DayNumber) | ||||
Return value | ||||
Type |
Description | |||
Double |
The date determined | |||
Parameter | ||||
Use |
Name |
Type |
Passing |
Description |
Required |
YearNumber |
Long |
ByVal |
Year number |
Required |
MonNumber |
Long |
ByVal |
Monatszahl |
Required |
DayNumber |
Long |
ByVal |
Tageszahl |
If you specify values from 0 to 29 (inclusive) for the YearNumber argument, the program interprets this information as the years from 2000 to 2029. All other values are interpreted from 1930 to 1999. If possible, use the full 4 digits (for Example 2000).
Example
The following example uses numeric expressions instead of absolute date numbers. In this case, the DateSerial function returns the date for the day before the first day (1 - 1) of the month, which is two months before August (8 - 2), 10 years before 1990 (1990 - 10).
Dim CalcDate As Date
CalcDate := DateSerial(1990 - 10, 8 - 2, 1 - 1)
The result is 31 May 1980.