there is always something to develop
How to replace time part in datetime variable
The simpliest way of replacing the time in datetime variable without changeing the actual date is to do a trick as bellow:
declare @cDateTime datetime; declare @cHour integer; declare @cMinute integer; declare @cSecond integer; set @cDateTime=getdate(); set @cHour = 12; set @cMinute = 0; set @cSecond = 0; select dateadd(dd,0, datediff(dd,0,@cDateTime))+ dateadd(ss,(@cHour*3600)+(@cMinute*60)+@cSecond,0)
See also
Comments
"A best friend is like a four leaf clover ... hard to find, and lucky to have. "
You are 5483 reader
since 25th August 2009
Yes | 66.7% |
2 |
No | 33.3% |
1 |