mysql date/time question
| From: | js | Date: | Sat, 31 Jan 2004 19:32:15 +0000 |
| Subject: | mysql date/time question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-32741@lists.php.net to get a copy of this message | ||
ok, 2 questions. first, how do i do a mysql query that orders by date? like, say i want to have 5
newest members who have signed up? i want it to display only 5 also. how do i do that? like this?
$newestquery = "SELECT artid,title,artdate,artauthor FROM article WHERE artdate <= $today
ORDER BY artdate DESC LIMIT 5";
and also, my next question is how do i format the display of date and time from how MySQL stores it
to where i want it displayed differently in PHP? like, mysql will store it as YYYY-DD-MM and i want
it displayed in php as date("n.j.y.") and time displayed as $time =
date("g:ia"); my time and date columns are 2 different columns in my TABLE, and i want
to know how to format the date to enter into mysql and how to format it when i retrive it from
mysql. thanks for your help.
-james (im a newbie programmer)