hi,
I have DataRow that has a cell of type datetime, i've tried to convert the value to DateTime by (DateTime)row[7] and
Convert.ToDateTime(row[7]) but none of that works, why?
TY
How to convert Object type to DateTime type?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

naura paxRank #2,843 · 502 reputationPosted Nov 9, 2009, 10:31 PM EST
DateTime dt=new DateTime();
if(dr[7]["OrderDate"]!=DbNull.Value)
dt=Conver.ToDateTime(dr[7]["OrderDate"]);
try above (replace OrderDate with whatever column you have.
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Nov 9, 2009, 10:21 PM EST
Use this.
DateTime d=Convert.ToDateTime(row[7].ToString());
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Nov 9, 2009, 10:59 PM EST
Sorry. From your question I understood something else.
I thought row is DataRow and 7 is the column index. Coz you have talked about a cell.
But accrording to the accepted answer, it seems 'row' is your row colloction.