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

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

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

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. Ugur Ekinci

    SQL-ASP.NET datetime format problem ???

    Ugur Ekinci, Dec 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    21,273
    AdrianJMartin
    Dec 16, 2005
  2. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    1,049
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  3. mp
    Replies:
    1
    Views:
    680
    John Machin
    Jul 28, 2006
  4. Steve Kershaw
    Replies:
    0
    Views:
    10,975
    Steve Kershaw
    Aug 26, 2006
  5. Steve Kershaw
    Replies:
    5
    Views:
    6,187
    Steve Kershaw
    Aug 29, 2006
  6. Martin
    Replies:
    0
    Views:
    646
    Martin
    Dec 27, 2008
  7. Replies:
    2
    Views:
    1,063
    M.-A. Lemburg
    Jan 6, 2009
  8. NiklasRTZ

    datetime.datetime. or datetime. ?

    NiklasRTZ, Oct 8, 2009, in forum: Python
    Replies:
    10
    Views:
    761
    niklasr
    Oct 11, 2009
Loading...