Click to See Complete Forum and Search --> : Convert Milliseconds to Readable DateTime c#


amean_n
04-19-2011, 08:06 AM
Hi there,
I'm trying to output into the gridview row (15) the date in dd/mm/yy or any other readable format.

I keep getting an exception.

Whta can I cahnge in the following code to fix this issue?

Many thanks.

I have to following code:

protected void gvReport_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

Int64 iEntryDate = Convert.ToInt64((string)e.Row.Cells[15].Text);
System.DateTime dt = new System.DateTime(1970, 1, 1);
dt = dt.AddSeconds(iEntryDate);
string s = dt.ToLongDateString();
e.Row.Cells[15].Text = s;



}
}

aj_nsc
04-19-2011, 08:31 AM
what's the exception?

amean_n
04-19-2011, 08:36 AM
value to add was out of range