DateSerial Function


DateSerial Function

Class

Microsoft.VisualBasic.DateAndTime

Syntax

     Dim result As Date = DateSerial(year, month, day) 


year (required; Integer)

The year, a number between 1 and 9999, inclusive


month (required; Integer)

The month, a number between 1 and 12, inclusive


day (required; Integer)

The day, a number between 1 and 31, inclusive

Description

The DateSerial function returns a Date with the value that is specified by the three date components.

Usage at a Glance

  • If the month or day value exceeds its normal limits in either a positive or negative direction, DateSerial adjusts the date accordingly. For example, if you try DateSerial(2005, 1, 35)January 35, 2005DateSerial returns February 4, 2005.

  • If any of the parameters exceed the range of the Integer data type, a runtime error occurs.

  • DateSerial handles two-digit years in the same way as other Visual Basic date functions. A year argument between 0 and 29 is taken to be in the current century; year arguments between 30 and 99 are taken to be in the previous century.

See Also

DatePart Function, DateString Property, DateValue Function, TimeSerial Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net