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
"An expert is a person who has made all the mistakes that can be made in a very narrow field."
You are 5513 reader
since 25th August 2009
Yes | 66.7% |
2 |
No | 33.3% |
1 |