date format

  • This is another way and doesn't use the convert statement:

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

  • Lynn Pettis (9/23/2009)


    This is another way and doesn't use the convert statement:

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

    Thanks Lynn,

    Got it.

  • Thanks Fausto

  • you're welcome

  • Wait a second. Is there a reason this data can't be a datatype of datetime?

    I have found that this is the fastest way to strip off time, and yet leave it as datetime.

    select DATEADD(DAY,DATEDIFF(DAY,0, getdate()),0)

    or in your example:

    select DATEADD(DAY,DATEDIFF(DAY,0, '2009-09-18 12:54:59.860'),0)

Viewing 5 posts - 16 through 19 (of 19 total)

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