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
"The most beautiful things in the world cannot be seen or even touched, they must be felt with the heart."
You are 3559 reader
since 25th August 2009
Yes | 66.7% |
2 |
No | 33.3% |
1 |