4
Answers

How to Declare Null value in Datetime

sai vital

sai vital

8y
344
1
if (date2 == "")
{
date2 = null;
}
DateTime dates2 = DateTime.ParseExact(date2, "dd-MM-yyyy H:mm", CultureInfo.InvariantCulture);
by using this code i got an Error 'String reference not set to an instance of a String.'. 

Answers (4)