开发者

(php) date and time

How to get date and time into one string ($moment) and if it works, can mysql do this:

SELECT * FROM table ORDER BY $m开发者_StackOverflowoment ASC ?


Assuming you have a TIMESTAMP or a DATETIME column, then the date() function will give you a suitable value to use in a query:

$moment = date("Y-m-d H:i:s");  //current time

The query you put in your question doesn't seem to use it at all however. Using ORDER BY on a datetime/timestamp column does work though, so you'll get the result set in chronological order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜