Wednesday, February 08, 2012

SqlServer–getting only the date part of DateTime field

One method is to use the DatePart method.

But here is a much nicer way to get the Date Portion:

CAST(FLOOR( CAST( GETDATE() AS FLOAT ) )AS DATETIME)

No comments: