note 58395 added to function.date
| From: | vernon at vernonkesner dot com | Date: | Wed, 02 Nov 2005 17:37:26 +0000 |
| Subject: | note 58395 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97997@lists.php.net to get a copy of this message | ||
The examples for getting a date in the past or future is simply not the best way to do it.
Especially if you are doing it dynamically.
I find the best way to get a date in the past or future is like this:
<?php
//get timestamp for past/future date I want
$pf_time = strtotime("-3 days");
//format the date using the timestamp generated
$pf_date = date("Y-m-d", $pf_time);
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58395
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58395&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58395&report=yes
Search -- http://master.php.net/manage/user-notes.php