Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a DateTime be null? [duplicate]

Tags:

People also ask

Can a DateTime be null?

DateTime CAN be compared to null; It cannot hold null value, thus the comparison will always be false. DateTime is a "Value Type". Basically a "value type" can't set to NULL. But by making them to "Nullable" type, We can set to null.

Can we assign null to DateTime in C#?

CSharp Online TrainingUsing the DateTime nullable type, you can assign the null literal to the DateTime type. A nullable DateTime is specified using the following question mark syntax.

How do you handle null values in a date column?

If you have a STRING column where its format is like TIMESTAMP , you can simply apply it. Then, DATE will extract just the date and it takes care of the NULL values.

How do I insert a null into a date field?

"NULL" can be specified as a value in the Date field to get an empty/blank by using INSERT statement. Example: CREATE table test1 (col1 date); INSERT into test1 values (NULL);


Possible Duplicate:
DateTime “null” value

is it possible to set datetime object to null?