Returns a value of type DateTime for a specified year, month, and day.
Copy Code |
---|
DateTime DateSerial ( |
To specify a date, such as December 31, 1991, the range of numbers for each DateSerial parameter should be in the accepted range for the unit; that is, 1-31 for days and 1-12 for months. However, you can also specify relative dates for each parameter using any numeric expression that represents some number of days, months, or years before or after a certain date.
When any parameter exceeds the accepted range for that parameter, it increments to the next larger unit as appropriate. For example, if you specify 35 days, it is evaluated as one month and some number of days, depending on where in the year it is applied. However, if the date specified by the three parameters, either directly or by expression, falls outside the acceptable range of dates, an error occurs.