Name

DateValue Function — Microsoft.VisualBasic.DateAndTime

Synopsis

DateValue(stringdate)
stringdate required; String

A string containing any of the date formats recognized by IsDate

Return Value

A Date that represents the date specified by the stringdate argument

Description

Converts the string representation of a date to a Date data type while dropping any time component. The date value is formatted according to the short date setting defined by the Regional Settings applet in the Control Panel. DateValue can successfully recognize stringdate in any of the date formats recognized by IsDate, but the order of the day, month, and year within stringdate must be the same as that defined by the computer’s regional settings. If you don’t specify a year in your date expression, DateValue uses the current year from the computer’s system date. DateValue does not return time values in a date/time string: they simply dropped. However, if stringdate includes an invalid time value, an exception results.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.