View Single Post

   
  #3 (permalink)  
Old 02-29-2008, 06:30 AM
Erland Sommarskog
 
Posts: n/a
Default Re: various working with dates issues

(wireless200@yahoo.com) writes:
> If I do it like this: Convert(varchar 20),record_date+access_time,100),
> it adds field 2 ok but subtracts two days. So for example 3/1/05 +
> 10:30:00 AM = 2/27/05 10:30:00 AM. So it effectively subtracts two
> additional days for no apparent reason. If is use
> record_date+2+access, then this returns the correct answer.


SELECT convert(datetime, convert(char(8), field1, 112) + ' ' +
convert(char(12), field2, 118))



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Reply With Quote