date format question

Discussion in 'ASP .Net' started by =?Utf-8?B?QXJ0eVNpbg==?=, Oct 20, 2006.

  1. I have a problem trying to get a date format of dd/mm to appear in my web
    page from a sql server database table. Various sites state that you can use
    the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of '20
    Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
    ideas? Code I have is below. Thanks in advance.

    <%#String.Format("{0:dd/mm}",
    Convert.ToDateTime(Container.DataItem("Date")))%>
     
    =?Utf-8?B?QXJ0eVNpbg==?=, Oct 20, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?QXJ0eVNpbg==?=

    Eric Theil Guest

    Try:

    String.Format("{0:dd/MM}", ...);

    lowercase m represents minutes and uppercase represents months

    e

    "ArtySin" <> wrote in message
    news:...
    >I have a problem trying to get a date format of dd/mm to appear in my web
    > page from a sql server database table. Various sites state that you can
    > use
    > the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of
    > '20
    > Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
    > ideas? Code I have is below. Thanks in advance.
    >
    > <%#String.Format("{0:dd/mm}",
    > Convert.ToDateTime(Container.DataItem("Date")))%>
     
    Eric Theil, Oct 20, 2006
    #2
    1. Advertising

  3. BRILLIANT!!! well done works perfectly.

    "Eric Theil" wrote:

    > Try:
    >
    > String.Format("{0:dd/MM}", ...);
    >
    > lowercase m represents minutes and uppercase represents months
    >
    > e
    >
    > "ArtySin" <> wrote in message
    > news:...
    > >I have a problem trying to get a date format of dd/mm to appear in my web
    > > page from a sql server database table. Various sites state that you can
    > > use
    > > the{0:dd/mm/yyyy} format which works fine as does {0:d} for a result of
    > > '20
    > > Oct' but {0:dd/mm} returns the day but only '00' for the month. Anyone any
    > > ideas? Code I have is below. Thanks in advance.
    > >
    > > <%#String.Format("{0:dd/mm}",
    > > Convert.ToDateTime(Container.DataItem("Date")))%>

    >
    >
    >
     
    =?Utf-8?B?QXJ0eVNpbg==?=, Oct 20, 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. Brian Candy
    Replies:
    2
    Views:
    1,194
    Janaka
    Feb 18, 2004
  2. DC
    Replies:
    5
    Views:
    3,028
    Brendan Reynolds
    Jul 1, 2005
  3. Peter Grison

    Date, date date date....

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

Share This Page