Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: DateFloor Function

    This is not the best way to implement this -- See http://stackoverflow.com/questions/85373/floor-a-date-in-sql-server

    declare @datetime datetime;

    set @datetime = getdate();

    select @datetime;

    select dateadd(year,datediff(year,0,@datetime),0);

    select dateadd(month,datediff(month,0,@datetime),0);

    select dateadd(day,datediff(day,0,@datetime),0);

    select dateadd(hour,datediff(hour,0,@datetime),0);

    select dateadd(minute,datediff(minute,0,@datetime),0);

    select dateadd(second,datediff(second,'2000-01-01',@datetime),'2000-01-01');

    or converted to this function:

    create...

Viewing post 1 (of 1 total)