Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if an object is a DateTime in VB.NET

The following works fine in c# (assuming value is an object):

if (value is DateTime)

What is the equivalent check for VB.NET?

like image 637
DanP Avatar asked Oct 22 '10 16:10

DanP


People also ask

How to declare DateTime in VB net?

Creating a DateTime ObjectBy assigning the DateTime object a date and time value returned by a property or method. By parsing the string representation of a date and time value. By calling the DateTime structure's implicit default constructor.

How to format Date in VB net?

You must specify the date value in the format M/d/yyyy, for example #5/31/1993# , or yyyy-MM-dd, for example #1993-5-31# . You can use slashes when specifying the year first. This requirement is independent of your locale and your computer's date and time format settings.

How do I assign a null value to a DateTime variable in VB net?

“DateTime is a value type (a structure) and can not be set to null or nothing as with all . Net value types. The default value for a datetime value is zeros for the date portion and 12:00:00 AM for the Time portion.”


1 Answers

The VB.Net equivalent is

If TypeOf(value) Is DateTime Then
like image 139
tnyfst Avatar answered Oct 19 '22 04:10

tnyfst