How to determine dates by number of days from now - "What date is 180 days from now?"
+1
A:
getdate() + 180
for example:
select getdate() as Today, getdate() + 180 as About6MonthsLater
RedFilter
2010-02-23 15:19:53
I am currently struggling the dates
Kip Birgen
2010-02-23 15:25:17
@Kip: I don't understand what you mean.
RedFilter
2010-02-23 15:26:08
+1, what I was thinking. In SQL Server you can use addition and subtraction on DATETIMEs in day increments, with no need for DATEADD()
KM
2010-02-23 15:30:39
A:
Since you just want the date, the time part should be stripped out after the calculation is done.
SELECT CONVERT (DATETIME, CONVERT (VARCHAR (20), DATEADD(d, 180, GetDate()), 101))
Raj More
2010-02-23 15:30:26
A:
To find 180 days ahead and remove the time component in one easy go.
No relying on internal implementation (using +) or string handling to chop time.
SELECT DATEADD(day, DATEDIFF(day, 0, GETDATE()), 180)
gbn
2010-02-23 17:23:22