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. Advertising

  2. <the date>.tostring("d") or you could do a <the date>.tostring("mm/dd/yyyy")

    "Henry Lee" wrote:

    > 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
    >
    >
    >
    =?Utf-8?B?QWFyb24=?=, Mar 28, 2006
    #2
    1. Advertising

  3. 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.
    --
    brians
    http://www.limbertech.com


    "Henry Lee" wrote:

    > 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
    >
    >
    >
    =?Utf-8?B?YnJpYW5zW01DU0Rd?=, Mar 28, 2006
    #3
  4. Well, there is a method called ToShortDateString()

    alternatively, you can fully format a date to a string by using ToString()
    and specifying the format.

    http://msdn.microsoft.com/library/d...ide/html/cpconcustomdatetimeformatstrings.asp

    Karl
    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "Henry Lee" <> wrote in message
    news:O2z%...
    > 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
    >
    Karl Seguin [MVP], Mar 28, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Candy
    Replies:
    2
    Views:
    1,155
    Janaka
    Feb 18, 2004
  2. MattB
    Replies:
    3
    Views:
    958
    rviray
    Aug 11, 2005
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,242
    Michael Borgwardt
    May 30, 2004
  4. Summu82
    Replies:
    5
    Views:
    860
    Richard Heathfield
    Jun 7, 2006
  5. Luqman
    Replies:
    3
    Views:
    5,897
    luqman
    Jul 3, 2007
Loading...

Share This Page