Add 1 day to GETDATE()
GETDATE() function t-sql is used to get current systemdate and time
if you want to add 1 day to GETDATE() this is how you do it
select * from table where ProgrameDate >= Convert(VarChar(10), DATEADD(day, -1, GETDATE()), 101)
you can use DATEDIFF to subtract date from current date
the following table from MSDN lists functions available for datetime in t-sql
Function | Determinism |
---|---|
DATEADD | Deterministic |
DATEDIFF | Deterministic |
DATENAME | Nondeterministic |
DATEPART | Deterministic except when used as DATEPART (dw,date) or DATEPART (wk,ww, date ). dw, the weekday datepart, depends on the value that is set by SET DATEFIRST, which sets the first day of the week. The week (wk, ww) datepart reflects changes that are made to SET DATEFIRST. January 1 of any year defines the starting number for the week datepart, for example: DATEPART(wk,‘Jan 1, xxxx‘) = 1, where xxxx is any year. |
DAY | Deterministic |
GETDATE | Nondeterministic |
GETUTCDATE | Nondeterministic |
MONTH | Deterministic |
YEAR | Deterministic |
Recent Comments