【发布时间】:2013-09-02 07:41:27
【问题描述】:
我正在尝试将小时数添加到当前时间,例如
-- NOT A VALID STATEMENT
-- SELECT GetDate(DATEADD (Day, 5, GETDATE()))
如何在 SQL Server 中提前数小时?
【问题讨论】:
-
DATEADD (datepart , number , date )所以...declare @num_hours int; set @num_hours = 5; select dateadd(HOUR, @num_hours, getdate()) as time_added, getdate() as curr_date
标签: sql-server-2008