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);
.
精彩评论