开发者

how to format the time in php

the time stor开发者_如何转开发ed in mysql is like this style((1300774889), now i want to output it in php file like this style: 2011-3-23. how should i do? eg:the time field is $row->time


Use the date function.

Example:

date("Y-m-d", $row->time);

Demo:

http://codepad.org/WrCEhNQH


Use the date function.

echo date( 'Y-m-d', $row->time )


Use the date() function, see php.net date for reference.

For your example, this should work $date = date("Y-m-d", 1300774889);.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜