IsDate Function in VB.NET

What is the use of IsDate Function in VB.NET?

Explanation

IsDate Function

IsDate Function in VB.net 2008 checks if the given expression is a valid date and returns a boolean true or false.
Syntax:

IsDate(Expession)
Example:

Module Module1
Sub Main()
Dim curdat As Date
curdat = "5/31/2010"
Console.WriteLine("Is '5/31/2010' a valid date::"
& IsDate(curdat))
Console.ReadLine()
End Sub
End Module
Result:

Is '5/31/2010' a valid date:: True

In the above example, the date given as the argument is valid, the IsDate function returns True.

Visual Basic Tutorial


Ask Questions

Ask Question