I have found something really weird today while doing a work converting a datetime to text in excel and using the number generated by it to convert to datetime in SQL Server.
What is weird about it? Different results. Two days difference to be precise.
I assumed the date of today (20/05/2014 dd/MM/yyyy ) in Excel and got 41779 as result in text.
I got the text value and I use SQL convert to datetime
to retrieve the value as date and I did not get the result I wanted.
I even tested with datetime2
but I learned that I can't convert int
to datetime2
I'm not a MS Excel expert nor a SQL Server expert, but what is going on? I can make it work by doing the number generated by MS Excel and removing 2, but still doesn't make sense to me.