Date Conversion

  • Hi,

    I run the following query with the following output

    select * from table1 where db = 'a' and time >= '01-01-2011'?

    2011-02-17 12:19:04.420

    2011-02-17 12:19:09.200

    2011-06-21 11:36:39.957

    My problem is how can I get this to display as UK dd-mm-yy without the time?

    Thanks

  • SELECT COL1,COL2... convert(varchar,YOUR_DATE_COLUMN, 3)

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • SELECT COL1,COL2... convert(varchar,YOUR_DATE_COLUMN, 3) leads to dd/mm/yy, while you mentioned dd-mm-yyyy that should be

    SELECT COL1,COL2... convert(varchar,YOUR_DATE_COLUMN, 105)

    Ronald HensbergenHelp us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/-------------------------------------------------------------------------2+2=5 for significant large values of 2

  • Thanks

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply