DateSerial

Returns a date given a year, month, and day.

Syntax
      DateSerial(year, month, day)

Key
   year   Integer. Number between 100 and 9999, inclusive, or a numeric expression.
month Integer. Any numeric expression.
day Integer. Any numeric expression.

The interpretation of two-digit years will vary according to the versions of Windows. To be sure the function returns the proper value, use a four-digit year.

The DateSerial() function may be used in VBA or in an SQL query.

Examples

Dim dtmArrival As Date

dtmArrival = DateSerial (2012, 12, 31)

'in SQL:
Expr1:DateSerial (2012, 12, 31)

“If you are planning for a year, sow rice; if you are planning for a decade, plant trees; if you are planning for a lifetime, educate people” ~ Chinese Proverb

Related:

Date - Return the current date.
DateAdd - Add a time interval to a date.
DateDiff
- Return the time difference between two dates.


© Copyright SS64.com 1999-2014
Some rights reserved