little tips and tricks, which i stumbled upon randomly

Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Tuesday, June 3, 2014

How to convert Excel serial date (integer) to SQL date format

For dates between 01.01.1900 and 28.02.1900 subtract 1 from integer to find correct date.

For dates 01.03.1900 onwards subtract 2 from integer to find correct date.

So it is safe to assume following will work:
SELECT DATEADD(DAY,<VALUE> -2, '01.01.1900'