MySQL Forums
Forum List  »  Newbie

Re: Check dates
Posted by: Chevy Mark Sunderland
Date: February 20, 2012 01:48PM

I try this sql (it's correct? ...):

SELECT `t_Date` FROM `myFirstTableMysql`
WHERE `t_Date` BETWEEN '2011-01-01' AND ADDDATE(CURDATE(),INTERVAL - 1 YEAR);

But the `first date` (2011-01-01) is always the first date of previous year compare than current year.

E.g.: year 2012, `first date` is 2011-01-01
E.g.: year 2013, `first date` is 2012-01-01

Now I need make the number of days in the month returned by ADDDATE(CURDATE(),INTERVAL - 1 YEAR).

In this case `2012-02-20` would 28.

Hope to get an answer on this soon, thanks!



Edited 3 time(s). Last edit at 02/20/2012 01:56PM by Chevy Mark Sunderland.

Options: ReplyQuote


Subject
Written By
Posted
February 20, 2012 04:28AM
February 20, 2012 07:46AM
February 20, 2012 08:18AM
February 20, 2012 07:16AM
Re: Check dates
February 20, 2012 01:48PM
February 25, 2012 12:12AM
February 24, 2012 07:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.