Returns a date for a specified year, month, and day.
The Pm.CreateDate method allows to set the value of the date and time together including milliseconds.
DateSerial(year As Integer, month As Long, day As Long) As Date
d = DateSerial(year, month, day)
|year||(Integer) year. Number between 100-9999.|
|month||(Long) month. Number between 1-12.|
|day||(Long) day. Number between 1-31.|
For the year argument, values in the range 0-99, inclusive, are interpreted as the years 1930–2029. For all other year arguments, use a complete 4-digit year (e.g. 1800).
If any argument exceeds the accepted range for that argument, then 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 any single argument is outside the range -32,768 to +32,767, or if the date specified by the three arguments, either directly or by expression, falls outside the acceptable range of dates, then an error occurs.
The example uses numeric expressions instead of absolute date numbers. The function returns a date that is the day before the first day (1–1) of two months before August (8–2) of 10 years before 2025 (2025–10); in other words, May 31, 2015.
DateSerial(2025-10, 8-2, 1-1)