将getdate()转换为int [英] Convert getdate() to int

查看:273
本文介绍了将getdate()转换为int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下查询时:

select convert(int, getdate())

我得到结果:

-----------
41238

(1 row(s) affected)

有人知道这是什么意思吗?

Does anyone knows what does this mean?

推荐答案

其天数因为我认为 1/1/1900 ,所以sql-server会保留从那以后的天数。

Its the number of days since I think 1/1/1900, sql-server keeps the number of days since then.

尝试除法该数字大约为365。
您应该以年为单位重新获得值(112)。
自1900年以来+ 112 = 2012

Try dividing that number by roughly 365. You should get the value back in years (112). Since 1900 + 112 = 2012

这篇关于将getdate()转换为int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆