note 26903 added to function.date
| From: | elk at jutro dot info | Date: | Sat, 16 Nov 2002 23:47:16 +0000 |
| Subject: | note 26903 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39581@lists.php.net to get a copy of this message | ||
There is a mistake in the (some way up) upper example.
If you want to find out how much time is left to a date (e.g. timestamp taken from postgres) you can
do sth like this:
$fifi = strtotime(!!timestamp!!) - time();
in place of !!timestamp!! you can put any string, e.g. pg_result($result,0,datetime) from your
database.
$fifi contains number of seconds beetween the date and current date. Now you only have to div it
e.g. by 3600 to get number of hours.. and so on...
$fifi is negative (<0) when the day has passed, and is >0 when it hasn't been reached
yet. It IS very useful knowledge ;)
sorry but i'm not good in explaining things..
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+26903
http://master.php.net/manage/user-notes.php?action=delete+26903
http://master.php.net/manage/user-notes.php?action=reject+26903