Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Date Problem

Author  Topic 

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-06-04 : 06:38:28
I wonder if any one can get there head round this I have a date field that reads the following 39937.0 I have tried Cast & Convert to change it to the correct date but it seems to add 2 days on. The actual Date should be 04/05/09 but when I use the Cast Or Convert statements it gives me the 06/05/09.

Many Thanks

Whitmoj
If I have inspired one person today then my job is done.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-04 : 06:42:03
If the date value originally derives from Excel, you are correct the date is two days off because of another base date (date zero) for Excel.

SELECT DATEADD(DAY, -2, Col1)



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

whitmoj
Yak Posting Veteran

68 Posts

Posted - 2009-06-04 : 07:17:54
Many thanks Peso works a treat

Whitmoj
If I have inspired one person today then my job is done.
Go to Top of Page
   

- Advertisement -