How to change Date Format?

Discussion in 'ASP .Net' started by Shapper, May 5, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I have this code line:
    <%# DataBinder.Eval(Container.DataItem, "publication_date") %>

    Which displays the date and time as follows:
    02-04-2005 0:00:00

    How can I change the date format to text?

    Thanks,
    Miguel
    Shapper, May 5, 2005
    #1
    1. Advertising

  2. Shapper

    Karl Seguin Guest

    DataBinder.Eval accepts a 3rd parameter which is the string format.

    <%# DataBinder.Eval(Container.DataItem, "blah", "{0:dd/mm/YYYY}") %>

    Check out:
    http://msdn.microsoft.com/library/d...e/html/cpconstandarddatetimeformatstrings.asp

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is
    annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)
    "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    news:...
    > Hello,
    >
    > I have this code line:
    > <%# DataBinder.Eval(Container.DataItem, "publication_date") %>
    >
    > Which displays the date and time as follows:
    > 02-04-2005 0:00:00
    >
    > How can I change the date format to text?
    >
    > Thanks,
    > Miguel
    >
    Karl Seguin, May 5, 2005
    #2
    1. Advertising

  3. Shapper

    Shapper Guest

    Thanks,

    That was what I was looking for.

    Thanks Once Again,
    Miguel

    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:karl REMOVE @ REMOVE openmymind REMOVEMETOO .
    ANDME net:

    > DataBinder.Eval accepts a 3rd parameter which is the string format.
    >
    > <%# DataBinder.Eval(Container.DataItem, "blah", "{0:dd/mm/YYYY}") %>
    >
    > Check out:
    > http://msdn.microsoft.com/library/d...e/html/cpconstandarddatetimeformatstrings.asp
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/ - New and Improved (yes, the popup is
    > annoying)
    > http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    > come!)
    > "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
    > news:...
    >
    > > Hello,
    > >
    > > I have this code line:
    > > <%# DataBinder.Eval(Container.DataItem, "publication_date") %>
    > >
    > > Which displays the date and time as follows:
    > > 02-04-2005 0:00:00
    > >
    > > How can I change the date format to text?
    > >
    > > Thanks,
    > > Miguel
    > >
    Shapper, May 5, 2005
    #3
  4. Shapper

    anil2082

    Joined:
    Mar 31, 2008
    Messages:
    1
    MM/dd/yyyy

    Is it possible to get the MM/dd/yyyy format.
    I need to use '/'.
    anil2082, Mar 31, 2008
    #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,138
    Janaka
    Feb 18, 2004
  2. DC
    Replies:
    5
    Views:
    2,988
    Brendan Reynolds
    Jul 1, 2005
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,197
    Michael Borgwardt
    May 30, 2004
  4. Chu
    Replies:
    3
    Views:
    4,167
    Shawn
    Aug 15, 2006
  5. Josh Sharpe
    Replies:
    1
    Views:
    195
    Brian Candler
    Sep 21, 2010
Loading...

Share This Page