Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2642
  • Last Modified:

SQL - Select 180 days from today (Query)

I used dateadd(d,-180,GETDATE())  which pulls wrong date.

SELECT  dateadd(d,-180,GETDATE())
--2012-07-07 14:36:21.380


select * from Table1
Where startdate>= 180 days from Today.

Roughly from June month onwards ??
0
chokka
Asked:
chokka
  • 2
1 Solution
 
Steve WalesSenior Database AdministratorCommented:
The date shown is correct.

July through December is 6 months - roughly 180 days.

Today is January 3rd.  Allowing for 365 days in a year, 7th of July is about 180 days ago.

If you want from the start of June onwards, you're talking 210 days give or take (216 days if you want to be accurate and starting from today).
0
 
chokkaAuthor Commented:
okay great, thanks !! just had a doubt on my query !!
0
 
chokkaAuthor Commented:
Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now