SQL datetime format

Discussion in 'ASP .Net' started by frank frank via DotNetMonster.com, Apr 19, 2005.

  1. Hello,

    When I get a value( smalldatetime data type) from MSSQL database out and
    bind with dataGrid, it will display something like "19/04/2005 12:00:00
    AM". Now I want it like "19/04/2005".

    I'd appreciate any clue !
    Franky

    --
    Message posted via http://www.dotnetmonster.com
     
    frank frank via DotNetMonster.com, Apr 19, 2005
    #1
    1. Advertising

  2. Set the DataFormatString property of the BoundColumn (if that's what you
    use) to {0:d}. (Short date format)
    (This is the Format String in the Property Builder)

    There's loads of ways to format a date btw, more can be found here:
    http://msdn.microsoft.com/library/d...e/html/cpconstandarddatetimeformatstrings.asp

    HTH,
    Lars-Erik

    "frank frank via DotNetMonster.com" <> wrote
    in message news:...
    > Hello,
    >
    > When I get a value( smalldatetime data type) from MSSQL database out and
    > bind with dataGrid, it will display something like "19/04/2005 12:00:00
    > AM". Now I want it like "19/04/2005".
    >
    > I'd appreciate any clue !
    > Franky
    >
    > --
    > Message posted via http://www.dotnetmonster.com
     
    Lars-Erik Aabech, Apr 19, 2005
    #2
    1. Advertising

  3. frank frank via DotNetMonster.com, Apr 19, 2005
    #3
  4. Glad I could help :)

    L-E


    "frank frank via DotNetMonster.com" <> wrote in
    message news:...
    > Mr Lars-Erik Aabech , you are my hero ,:D
    > Great thanks
    >
    > --
    > Message posted via http://www.dotnetmonster.com
     
    Lars-Erik Aabech, Apr 19, 2005
    #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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    719
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    544
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    397
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    343
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    765
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page