Mssql date function [query integer days or integer months] select to query the entire month's & nbsp; * from & nbsp; tbwhere & nbsp; datediff (hh, time field, getdate ()) 0 & nbsp; selectdateadd (mm, 2, getdate () selectdateadd (day, 2, getdate ()) query day and hour da mssql date functions [query integer days or integer months]
Select // query
*
From
Tb
Where
Datediff (hh, time field, getdate () = 0
Select dateadd (mm, 2, getdate ())
Select dateadd (day, 2, getdate ())
// Query the day and hour
Datediff (dd, time, getdate () -- day
Datediff (hh, time, getdate () -- hour
// Query the current
Select * from # tb where dateadd (mm, 2, datacol) = getdate ()
// Query all current data
Select
*
From
Tb
Where
Datediff (hh, time field, getdate () = 0 -- hour
And datediff (mi, time field, getdate () = 0 -- Second
// Use
Declare @ num int
Set @ num = 2
If dateadd (d, @ num, '2017-01-05 ') = getdate () or dateadd (m, 2, '2017-01-05 ') = getdate ()
Print 'yes'
Else
Print 'Not'
// Check whether the current time has exceeded an integer day or an integer month than the saved time.