DateSerial()

Top  Previous  Next

DateSerial() - Create a Date Variable from Day, Month and Year

Description

The DateSerial() function creates a date variable from the supplied day, month and/or year parameters.

Date = DateSerial(year, month, day)

Parameters
The year parameter should be a number or expression equalling between 100 and 9999. Values between 0 and 99, inclusive, are interpreted as the years 19001999. For all other years use a complete four-digit year (e.g. 2000).

The month parameter should be a number or expression equalling between 1 and 12 inclusive.

The day parameter should be a number or expression equalling between 1 and 31 inclusive.

Example

'Create a date variable for April 1, 2001

MyDate = DateSerial(2001, 4, 1)

 

'Create a date three years prior

MyDate = DateSerial(2001 - 3, 4, 1)