0

我正在从我的数据库中返回一个日期并将其转换为格式化的日期,但它没有显示完整的月份,而是显示为“Apr”。有没有办法让它显示整个月份而不仅仅是缩写?

代码

while(($row = mysql_fetch_array($query_date)))
    $date[] = date("M d",strtotime($row[0]));

这就是我的数据库返回2012-04-25 22:07:35的内容,日期函数返回这个Apr 25

4

4 回答 4

1

格式应该是,

while(($row = mysql_fetch_array($query_date)))
    $date[] = date("F d",strtotime($row[0]));

在这里,您可以获得所有格式..

http://php.about.com/od/learnphp/ss/php_functions_3.htm

于 2012-04-26T04:04:44.807 回答
0

使用F http://php.net/manual/en/function.date.php

$date[] = date("F d",strtotime($row[0]));
于 2012-04-26T04:03:17.283 回答
0

F不应该M...

$date[] = date("F d",strtotime($row[0]));
于 2012-04-26T04:03:59.377 回答
0

检查此链接: http: //php.net/manual/en/function.date.php,它可以为您提供有关日期格式所需的信息

在你的情况下,你需要改变

$date[] = date("M d",strtotime($row[0]));

$date[] = date("F d",strtotime($row[0]));

“F”返回整月(1 月到 12 月)。

于 2012-04-26T04:35:24.100 回答