No, your way doesn't work either.
$year = substr($date, 0,4);
$month = substr($date, 5, 2);
$day = substr($date, 8, 2);
$time_next_month = mktime(0, 0,
0, $month+1, $day, $year);
I think you mean
$time_next_month = strtotime('next month');
But that is not what you
want anyway.
If $timenow is a mysql date value (YYYY-MM-DD) then $timenow + $time_next_month is the same as $time_next_month + 2007, and a date field is always going
to be less than that.
mysql> SELECT '9999-12-31' < '2007-06-07' + 1183831815;
+------------------------------------------+
|
'9999-12-31' < '2007-06-07' + 1183831815 |
+------------------------------------------+
|
1 |
+------------------------------------------+
If $timenow is
unixtime then $timenow + $time_next_month is sometime in the year 2044.