I was writing to some code where I needed to read the date value from a Calendar control in my page (Ajax toolkit: calendar extender).
The code below:>
var Endtime = DateTime.Now();
DateTime startTime = item.REPORT_TIME.HasValue ? item.REPORT_TIME.Value : Endtime;
Means: the type of item.item.REPORT_TIME is system.DateTime?
howerver the type of startTime is system.DateTime;
so the code can changed it like
`var Endtime=DateTime.Now; var startTime=item.REPORT_TIME.HasValue?Convert.ToDateTime(item.REPORT_TIME.HasValue):Endtime
`