mysql date/time question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux