ITPub博客

首页 > 数据库 > SQL Server > SQL中时间的加减法

SQL中时间的加减法

原创 SQL Server 作者:liahtobjtosh 时间:2009-09-30 19:53:54 0 删除 编辑
SQL中时间的加减法[@more@]

-declare @temp datetime
set @temp = getdate();
select @temp
select dateadd(m,-9, @temp)

参数 m的可以被下面的值代替:
yyyy 年
q 季
m 月
y 一年的日数
d 日
w 一周的日数
ww 周
h 时
n 分钟
s 秒

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22565551/viewspace-1027536/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-09-19

  • 博文量
    48
  • 访问量
    249174