php - MySQL: Select date plus 6 months if less than now() plus 1 month -


i have given date:

2013-12-20 

this issue date of product product expiries in 6 months date of issue. expiration date not stored want check given issue date if expiring in next month of now().

so guess add 6 months issue date , check + interval of 1 month if expiring?

here tried:

select * `products` date_add(`issue_date`,interval 6 month)  < date(now() + interval 1 month) order `issue_date` asc 

what i'm doing wrong?

select * products now() <= date_add(issue_date, interval 7 month) && now() >= date_add(issue_date, interval 6 month) order issue_date asc;

  • the first item has returned has due date today (so issue date + 6 months = today);
  • than due date tomorrow (so issue date + 6 months + 1 day = today);
  • ...
  • than due date 1 month today(so issue date + 6 months + 1 month = issue date + 7 months = today)

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -