开发者

PHP Date Conversion [duplicate]

开发者 https://www.devze.com 2023-01-29 13:52 出处:网络
This question already has answers here: 开发者_如何学C Closed 11 years ago. Possible Duplicate: Format mysql datetime with php
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

精彩评论

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

关注公众号