Thursday, May 01, 2008

Excel & SQL Server date epochs

Just been caught out by this and so documenting it.

On Excel 2003
1 formatted as date = 1900-01-01

On SQL Server 2000
SELECT CONVERT(CHAR(8), CAST(1 AS DATETIME), 112) = 1900-01-02

Yes, the dates are out by a day.

Yes, this was very frustrating to discover.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.