当前系统时间为:2013-08-13 10:12
执行SQL语句
PRINT CAST(GETDATE() AS real)
print cast(41497.4 as datetime) --41497.4是上条SQL转换后的数字
输入的结果为:
41497.4
08 13 2013 9:36AM
怎么会这样?
------解决方案--------------------
DECLARE @date DATETIME
SET @date = '2013-08-13 10:12'
SELECT CAST(@date AS DECIMAL(10,4)) --用decimal类型,real是近似值,有误差
SELECT cast(41497.4250 as datetime)
SELECT DATEADD(MINUTE, 24*0.4250*60, DATEADD(DAY, 41497, 0))