note 72708 added to function.date
| From: | mtphotographer at yahoo dot com | Date: | Tue, 30 Jan 2007 15:37:28 +0000 |
| Subject: | note 72708 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122366@lists.php.net to get a copy of this message | ||
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
----
Server IP: 64.71.164.2
Probable Submitter: 65.213.163.8
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/72708
Del: integrated -- https://master.php.net/note/delete/72708/integrated
Del: useless -- https://master.php.net/note/delete/72708/useless
Del: bad code -- https://master.php.net/note/delete/72708/bad+code
Del: spam -- https://master.php.net/note/delete/72708/spam
Del: non-english -- https://master.php.net/note/delete/72708/non-english
Del: in docs -- https://master.php.net/note/delete/72708/in+docs
Del: other reasons-- https://master.php.net/note/delete/72708
Reject -- https://master.php.net/note/reject/72708
Search -- https://master.php.net/manage/user-notes.php