DateValue Function


DateValue Function

Class

Microsoft.VisualBasic.DateAndTime

Syntax

     Dim result As Date = DateValue(stringDate) 


stringDate (required; String)

A string containing any valid date format

Description

The DateValue function converts stringDate to the Date data type, setting any time component to midnight. The interpretation of the date components in the expression is based on the locale setting of the local computer.

Usage at a Glance

  • The supported date range of the Date data type is from January 1, 1 AD to December 31, 9999 AD in the Gregorian calendar.

  • You can check that a date is valid using the IsDate function.

  • If stringDate includes time information as well as date information, the time information is ignored. However, if only time information is passed to DateValue, an error is generated.

  • The DateValue function guesses the century if a two-digit year is supplied. It sometimes places it in the previous century and sometimes in the current century. In general, two-digit years under 30 appear in the current century, while those 30 and beyond appear in the previous century.

See Also

CDate Function, DatePart Function, DateSerial Function, DateString Property




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