|
Posted by Ross Presser on 07/22/05 00:14
On Thu, 21 Jul 2005 18:07:49 +0000 (UTC), Erland Sommarskog wrote:
> Anyway, the best way to strip out the time component is:
>
> convert(char(8), getdate(), 112)
that leaves you with a char value. I prefer
convert(datetime, floor(convert(float,getdate())))
even though it's a bit wordier, because it can't possibly be sensitive to
the region, and also because it has useful variants. Like this, which
rounds a time down to the start of the hour:
convert(datetime, floor(convert(float,getdate()) * 24) / 24)
Navigation:
[Reply to this message]
|