formatted date in grid view?

Discussion in 'ASP .Net' started by Smokey Grindle, Jun 22, 2006.

  1. In .NET 1.1 I could have a column bound with date/time fields.. then say the
    format of it was this {0:MMM d,yyyy h:mm tt} and it would display in this
    format

    Jan 1, 2006 2:03 PM

    however in .NET 2.0 doing the same thing in the grid view with a date time
    bound field to a column with the format string as {0:MMM d,yyyy h:mm tt}
    gives me this

    1/1/2006 02:03:00 PM

    how do you get the 1st format to show correctly in a grid view now? I really
    need to format the dates... thanks!
    Smokey Grindle, Jun 22, 2006
    #1
    1. Advertising

  2. Smokey Grindle

    Kushi Guest

    Hi,

    You need to set HtmlEncode property to false.

    <asp:BoundField DataField="BirthDate" HtmlEncode=false
    DataFormatString="{0:MMM d,yyyy hh:mm:ss}" HeaderText="BirthDate" />


    Thanks
    Sharmila
    (www.syncfusion.com)
    Kushi, Jun 23, 2006
    #2
    1. Advertising

  3. humm didnt realize it as html encoding before display.. thanks!

    "Kushi" <> wrote in message
    news:...
    >
    > Hi,
    >
    > You need to set HtmlEncode property to false.
    >
    > <asp:BoundField DataField="BirthDate" HtmlEncode=false
    > DataFormatString="{0:MMM d,yyyy hh:mm:ss}" HeaderText="BirthDate" />
    >
    >
    > Thanks
    > Sharmila
    > (www.syncfusion.com)
    >
    Smokey Grindle, Jun 23, 2006
    #3
    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. Luqman
    Replies:
    2
    Views:
    3,813
    Luqman
    Feb 1, 2006
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,253
    Michael Borgwardt
    May 30, 2004
  3. shapper
    Replies:
    4
    Views:
    701
    shapper
    Apr 26, 2007
  4. wahtnamas
    Replies:
    0
    Views:
    894
    wahtnamas
    May 1, 2009
  5. Parthiv Joshi
    Replies:
    1
    Views:
    669
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page