note 14429 deleted from ref.datetime by victor
| From: | victor@php.net | Date: | Mon, 09 Dec 2002 18:50:32 +0000 |
| Subject: | note 14429 deleted from ref.datetime by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40609@lists.php.net to get a copy of this message | ||
In addition to franck@gerbille.net's example. I needed a quick simple function that added 30
days to a date for a PHP Site running 3.0.7.
I came up with,
// -----------------------------
// -- Add thirty days --
// -----------------------------
$timenow = time();
$plusthirtydays = date("d-m-Y", $timenow + 2592000);
// -----------------------------
$plusthirtydays now contains your date, 30 days later than current.
You can change the timestamp if you wish to increase the number of days etc. And you can select
whether to add or subtract.
Alternatively, I believe strtotime() is a good function to do this job, available in 3.0.12
Its not much, but I like it :),
Amadiere