Re: Date() finding yesterday
| From: | Scott Hurring | Date: | Sun, 21 May 2006 18:17:34 +0000 |
| Subject: | Re: Date() finding yesterday | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236585@lists.php.net to get a copy of this message | ||
mktime also works: http://php.net/mktime:
date("Y-m-d", mktime( ... ))
On 5/21/06, Rabin Vincent <rabin@rab.in> wrote:
On 5/21/06, John Taylor-Johnston <John.Taylor-Johnston@cegepsherbrooke.qc.ca> wrote: I cannot seem to get this right. How can I produce yesterday? $today = date("Y-m-d"); $yesterday = date("Y-m-") . date("d")-1; $yesterday = date("Y-m-d")-1; $yesterday = date("Y-m-"."d"-1); I've been looking at the manual :) ... Use php.net/strtotime: $yesterday = date('Y-m-d', strtotime('-1 day')); Rabin -- http://rab.in -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- Scott Hurring [scott dot hurring dot lists at gmail dot com] http://hurring.com/