Skip navigation links

MySQL Forums :: Newbie :: Check dates


Advanced Search

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
Check dates Chevy Mark Sunderland 02/20/2012 04:28AM
Re: Check dates laptop alias 02/20/2012 07:46AM
Re: Check dates Chevy Mark Sunderland 02/20/2012 08:18AM
Re: Check dates laptop alias 02/20/2012 07:16AM
Re: Check dates Chevy Mark Sunderland 02/20/2012 01:48PM
Re: Check dates Rick James 02/25/2012 12:12AM
Re: Check dates Chevy Mark Sunderland 02/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.