note 15926 added to ref.datetime
| From: | rodzilla at rigbees dot com | Date: | Tue, 09 Oct 2001 06:06:14 +0000 |
| Subject: | note 15926 added to ref.datetime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18711@lists.php.net to get a copy of this message | ||
Simple way to calculate the days until something (looks like one of the entries above suggest
multiplying instead of dividing!). This'll return a nice number formatted to two (2) decimal
places.
$today = $strtotime("now");
$daysuntil = ((($timestamp - $today) / 60) / 60) / 24;
$daysuntil = number_format($daysuntil,2);
--
http://www.php.net/manual/en/ref.datetime.php
http://master.php.net/manage/user-notes.php?action=edit+15926
http://master.php.net/manage/user-notes.php?action=delete+15926
http://master.php.net/manage/user-notes.php?action=reject+15926