note 7347 deleted from time by torben
| From: | torben@php.net | Date: | Sun, 20 Aug 2000 03:53:01 +0000 |
| Subject: | note 7347 deleted from time by torben | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2694@lists.php.net to get a copy of this message | ||
Actually, the comment made by fishy@hotbot.com above is correct, just the sample code is messed up.
This should work (I have it working where the timestamp is part of a mysql_fetch_array result, but
it should also work with class based DB access):
<pre>
$temp = time($row[TimeVar]);
/* or...where $DB is a DB object
$temp = $DB->curr_row(TimeVar);//or something similar..
$temp = time($temp);
*/
$date = date("n/d/Y", $temp);
//that should set $date to the correct
//date based on the MySQL timestamp.
//Note that I have the timestamp
//length set to 8, witch reports the
//date in YYYYMMDD format.
</pre>
Timestamps are nice because all of the code for it is in MySQL, and they increment automatically.