HowTo check if Date is empty (#12.00.00 AM#) ???

A

Andreas Klemt

Hello,
I have this

Dim myDate As Date

...
...
How can I check if this date is empty (value #12.00.00 AM# is in there) ?

Thanks,
Andreas
 
C

Carl Prothman [MVP]

Andreas Klemt said:
I have this
Dim myDate As Date
How can I check if this date is empty (value #12.00.00 AM# is in there) ?

Andreas,
Try using the Date.MinValue property

If myDate = Date.MinValue Then
' myDate is empty
End If

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
A

Andreas Klemt

Thanks Carl,
that helped me!

What is better?
a) If myDate = Date.MinValue Then
b) If myDate.equals(Date.MinValue) Then

Regards,
Andreas
 
C

Carl Prothman [MVP]

Andreas Klemt said:
What is better?
a) If myDate = Date.MinValue Then
b) If myDate.equals(Date.MinValue) Then

Better? They do the same task.

I prefer the "=" since (IMHO) it's more readable. Plus it's less typing... ;-)

I think it comes down to developer preference...

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top