Results 1 to 3 of 3

Thread: Convert Milliseconds to Readable DateTime c#

  1. #1
    Join Date
    Aug 2010

    Convert Milliseconds to Readable DateTime c#

    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;

  2. #2
    Join Date
    Dec 2005
    what's the exception?

  3. #3
    Join Date
    Aug 2010
    value to add was out of range

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles