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
"Natural ability without education has more often attained to glory and virtue than education without natural ability."
You are 5168 reader
since 25th August 2009
Yes | 66.7% |
2 |
No | 33.3% |
1 |