there is always something to develop
How to get date part of datetime value
Very common problem is how to get date part of DATETIME column. The simplest way is: You can also use one of this methods:
First method
declare @cDateTime datetime; set @cDateTime = GetDate() select dateadd(dd,0, datediff(dd,0,@cDateTime))
... and the second
declare @cDateTime datetime; set @cDateTime = GetDate() select (CAST( CEILING( CAST( CAST(@cDateTime AS DATETIME) AS float ) )AS DATETIME)- (CEILING( CAST( CAST(@cDateTime AS DATETIME) AS float ) ) - FLOOR( CAST( CAST(@cDateTime AS DATETIME)as float ) ) )Download SQL script
See also
Comments
"Good people are good because they've come to wisdom through failure."
You are 5470 reader
since 1st April 2009
Yes | 0 | |
No | 0 |