how to convert nullable datetime datarow to datetime in c#

116

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);

Comments

Submit
0 Comments