save date time parse to null c# code example
Example 1: how to convert nullable datetime datarow to datetime in c#
object sqlDateTime = sqldatareader[0];
DateTime? dt = (sqlDateTime == System.DBNull.Value)
? (DateTime?)null
: Convert.ToDateTime(sqlDateTime);
Example 2: c# convert to nullable datetime
DateTime? lastPostDate = (DateTime?)(reader.IsDbNull(3) ? null : reader[3]);