2012-09-21

TSQL - Excel numeric date to SQL date

select

       40756 as ExcelDate
       , cast(dateadd(d, 40756, '1899-12-30') as date ) as TSQLDate
;

Excel dates are represented by numbers.
Decimals represent time... which is out of the scope of this post.
The trick is knowing that day 1 is for January 1st, 1900 (1900-01-01).


No comments:

Post a Comment