danielolorenz
asked on
Getting an Error When Comparing Date to Null?
I am getting an error when comparing date to null. Otherwise datetime works fine.
Examples:
if (MyDate == null)
x = 1;
Thanks,
Dan
Examples:
if (MyDate == null)
x = 1;
Thanks,
Dan
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is the type of MyDate?
ASKER
It is of type DateTime. Can you send me an example of how to correctly write this check?
Thanks,
Dan
Thanks,
Dan
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That isn't the problem. The problem is that you can not do the comparison. You can not check to see if something equals null. You can only check to see if it is Not null.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then I don't understand the difference. And I found out that PHP has 'NULL' as a defined value meaning no value so you can check for it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER