I am trying to set the date time to an empty value in my application - I am trying in the following way
string datetime = Convert.ToString(dataRow["dbfield"]).Trim();
MyDateTime= string.IsNullOrEmpty(datetime)
? (DateTime?) null
: GeneralUtilities.ConvertOTDateToDate(datetime);
The error I am getting is
cannot implicitly convert type System.Datetime? to System.Datetime, an explicit conversion exists are you missing a cast?
Please could someone help me with the correct syntax required for this please?
Thanks