How to make the short date format without time showing

Discussion in 'ASP .Net' started by Henry Lee, Mar 28, 2006.

  1. Henry Lee

    Henry Lee Guest

    hi , all
    In ASP2.0 , the date object always showing like "3/27/2006 12:00:00 AM"
    How to remove "12:00:00 AM" and only make it shows "3/27/2006" ?
    Thanks very much
    Henry
     
    Henry Lee, Mar 28, 2006
    #1
    1. Advertisements

  2. Henry Lee

    Guest Guest

    <the date>.tostring("d") or you could do a <the date>.tostring("mm/dd/yyyy")
     
    Guest, Mar 28, 2006
    #2
    1. Advertisements

  3. Henry Lee

    Guest Guest

    Hello Henry,

    You can get the short date formate from the datetime object by calling the
    DateTime.ToShortDateString() method. It is also the equivalent of calling the
    DateTime.ToString("d", null) method. Check out the help file for more
    information on Formatting Overview.
     
    Guest, Mar 28, 2006
    #3
  4. Karl Seguin [MVP], Mar 28, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.