Returns a date for a specified year, month, and day.
In the PROMOTIC system it is better to use the Pm.CreateDate method.
Date DateSerial(Integer year, Long month, Long 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 parameter, 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 parameter exceeds the accepted range for that parameter, then it increments to the next larger unit as appropriate. For example, 35 days is evaluated as one month and some number of days, depending on where in the year it is applied.
However, if any single parameter is outside the range -32,768 to +32,767, or if the date specified by the three parameters, 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.
VBScriptSelect and copy to clipboard
d = DateSerial(2025-10, 8-2, 1-1)