• CirquedeSQLeil (12/21/2009)


    Lynn Pettis (12/21/2009)


    CirquedeSQLeil (12/21/2009)


    I'm curious what the need is to convert a date to a Number. I would leave the date as one of the datetime datatype in sql 2005.

    Now to get the Date Format you seek, you will need to convert to varchar and check the following: http://www.sqlusa.com/bestpractices2005/centurydateformat/

    Actually, on the SQL side dropping the time portion off getdate is this simple:

    dateadd(dd, datediff(dd, 0, getdate()), 0)

    Noted and added to my toolbox - I had never used that method. Thanks Lynn.

    Check my blog for some other date routines. They might come in handy as well.