Date without time

  • Hi

    I need to ensure that the date value displayed in my SQL 2005 table datetime field is in British date format i.e. dd/mm/yyyy and not to show the time element i.e. 00:00:00. I want to retain the date format as I need to order on date.

    The DueDate field in my table is set up as datetime and values look like this when I simply open the table from Mgt Studio:

    DueDate

    2007-11-23 00:00:00

    2007-12-15 00:00:00

    2008-05-02 00:00:00

    2008-05-14 00:00:00

    2008-06-14 00:00:00

    When I use convert e.g.

    select convert(datetime, DueDate, 103) AS NewDate

    from dbo.InvWeekly order by DueDate

    I get these values returned:

    NewDate

    2007-11-23 00:00:00

    2007-12-15 00:00:00

    2008-05-02 00:00:00

    2008-05-14 00:00:00

    2008-06-14 00:00:00

    Is there a simple answer to obtaining results which look like this:

    (and which can be stored as a true date field to enable sorting)

    DueDate

    23/11/2007

    15/12/2007

    02/05/2008

    14/05/2008

    14/06/2008

    Thanks

  • Hi , try this link

    essential reading IMO : http://www.karaszi.com/SQLServer/info_datetime.asp



    Clear Sky SQL
    My Blog[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

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