Well, Here is the fundamental stuff of
nullable DateTime
.
DateTime
struct itself does not provide a null option. but we can make it a
nullable
type which allows you to assign the null to a datetime.
DateTime ? nullableDateTime = null ;
if(nullableDateTime.HasValue)
Console.WriteLine(nullableDateTime.Value.ToShortDateString());
As, my nullableDateTime is set to Null, above code block wont print anything.
This will only print a value, if the nullableDateTime has some value.
Come to the minimum date,
var defaultDateTimeValue = default(DateTime);
Here
defaultDateTimeValu
will be the
1/1/0001 12:00:00 AM}
But, for nullableType,
var defaultDateTimeValue = default(DateTime?);
the value of
defaultDateTimeValue
should be
null
.
I hope this will give you enough idea.