Results 1 to 2 of 2

Thread: display date and time in data grid

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    1

    Question display date and time in data grid

    hi!i need some help!when i retrieved the date from the database and display it in the data grid, the time keep showing as 12:00:00 AM. Actually i just want to display the date only but the time keep coming out after the date! Can anyone tell me what is the problem here and what can i do to make the time go away and only display the date?Thank you!

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774

    Re: display date and time in data grid

    Originally posted by jeffcky
    hi!i need some help!when i retrieved the date from the database and display it in the data grid, the time keep showing as 12:00:00 AM. Actually i just want to display the date only but the time keep coming out after the date! Can anyone tell me what is the problem here and what can i do to make the time go away and only display the date?Thank you!

    Code:
        DateTime myDate = DateTime.Now;
        Response.Write(myDate.ToString("d") + "<br>");
    
    // can use any of the following to format a date.
    
    // d Short Date 
    // D Long Date 
    // f Full (long date + short time) 
    // F Full (long date + long time) 
    // g General (short date + short time) 
    // G General (short date + long time) 
    // m, M Month/Day Date 
    // r, R RFC Standard 
    // s Sortable without TimeZone info 
    // t Short Time 
    // T Long Time 
    // u Universal with sort able format 
    // U Universal with Full (long date + long time) format 
    // y, Y Year/Month Date
    John

Posting Permissions

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



Click Here to Expand Forum to Full Width