note 72708 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 02:50:27 +0000 |
| Subject: | note 72708 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141993@lists.php.net to get a copy of this message | ||
Note Submitter: mtphotographer at yahoo dot com
----
Determine what is next month:
I Had the same issue as matt_wbdi at hotmail dot com
Simple solution is use 1 for the day instead of date("d"), it didnt seem to matter if I
use "m", or "n" for the month.
// eg:
// if today is 2007-01-30 the following:
$datePlusoneMonth = mktime(0, 0, 0, date("m")+ 1, date("d"),
date("Y"));
echo date("Y-m", $datePlusoneMonth);
//returns 2007-03 which is not next month
// this worked for me:
$datePlusoneMonth = mktime(0, 0, 0, date("m")+ 1, 1, date("Y"));
echo date("Y-m", $datePlusoneMonth);
// returns 2007-02, which IS next month