Viewing post 1 (of 1 total)
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...
December 29, 2011 at 11:51 am
Viewing post 1 (of 1 total)