开发者

PHP Date Conversion [duplicate]

This question already has answers here: 开发者_如何学C Closed 11 years ago.

Possible Duplicate:

Format mysql datetime with php

How to convert the following:

2010-12-07 12:00:00

into:

December, 7th, 2010


echo date("F, jS, Y", strtotime("2010-12-07 12:00:00"));

http://php.net/manual/en/function.date.php


Check out the date function.

$myDate = strtotime('2010-12-07 12:00:00');
$formattedDate = date('F, jS, Y', $myDate)


Use date_format

http://www.php.net/manual/en/function.date-format.php

$date = date_create('2010-12-07 12:00:00');
echo date_format($date, 'F, jS, Y');


echo date('F, jS, Y',strtotime('2010-12-07 12:00:00'));


$d = strtotime('2010-12-07 12:00:00');
echo date('F, jS, Y', $d); 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜