sai vital

sai vital

  • NA
  • 191
  • 2.2k

How to Declare Null value in Datetime

Jun 25 2016 1:43 AM
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)