I have some negative integer values which are an offset from the default 1-1-1900 date. I have to get the datetime values from these. How can I do this.
Example:
If I do:
SELECT convert(datetime, 53691) as Calc
OR
SELECT cast(53691 as datetime)
I get: 2047-01-01 00:00:00.000
What I need is that If I do:
SELECT convert(datetime, -53691) as Calc
OR
SELECT cast(-53691 as datetime)
I should get something like:
1开发者_Python百科753-01-01 00:00:00.000
-53690 would be 1753-01-01. -53691 takes you out of the range of the datetime data type (which doesn't support dates before 1753). Casting -53690 works as your other examples do.
精彩评论