RE: [PHP] today and yesterday (finding them)
| From: | Jason Murray | Date: | Wed, 31 Jan 2001 04:19:45 +0000 |
| Subject: | RE: [PHP] today and yesterday (finding them) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37413@lists.php.net to get a copy of this message | ||
> $today = getdate();
> $mon = $today[mon];
> $mday = $today[mday];
> $year = $today[year];
> $text=sprintf("%s-%s-%s", $year, $mon, $mday);
> $date=$text;
>
> This code gets me today in the form 0000-00-00
>
> What do I need to do to get yesterday in that form?
$today = Date("U");
$yesterday = $today-(24*3600); // 24 hours. 3600 seconds in an hour
$todayhumanlegible = Date("d m Y", $today);
$yesterdayhumanlegible = Date("d m Y", $yesterday);
Jason