On Mar 2, 2:19 pm, sorens... (AT) gmail (DOT) com wrote:
Quote:
I've been trying all morning to figure out a way to display the
number
of days/months between CURDATE() and a future date (myqsl column).
I've tried BETWEEN and something like this:
SUBDATE(CURDATE(), MAX(stopdate) AND NOW()) AS time_left
I guess trick is converting a date format to a number format. I don't
know, I'm lost!
Any guidance in the right direction would be GREATLY appreciated.
Thanks a lot. |
You're probably looking for these functions:
DATEDIFF()
Returns expr1 - expr2 expressed as a value in days from one date to
the other. expr1 and expr2 are date or date-and-time expressions. Only
the date parts of the values are used in the calculation
PERIOD_DIFF(P1,P2)
Returns the number of months between periods P1 and P2. P1 and P2
should be in the format YYMM or YYYYMM. Note that the period arguments
P1 and P2 are not date values.
-Tri