Does that code compile?
I do think you cannot assign a
DateTime
object to a
HeaderCell
object.
What you can do is to assign the
DateTime
value to the
HeaderCell
value like this
s.HeaderCell.Value = DateTime.Now.ToString();
If you want to retrieve the information you can use
DateTime headerTime = DateTime.Parse(s.HeaderCell.Value);