Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP/MySql中的格式化时间_Php_Mysql - Fatal编程技术网

PHP/MySql中的格式化时间

PHP/MySql中的格式化时间,php,mysql,Php,Mysql,我想将MySql结果中的日期格式化为这种格式(代码是我在网站其他地方使用的,而不是我试图使用的实际代码,我只想要这种格式) 我在网站的其他地方做过,但不知道如何格式化以下结果。它是for循环的一部分,$str_注释最终得到响应,显示带有用户名和注释日期的注释列表 $str_comments .= "<span class='comment'>" . mysql_result($result, $j, 'comment') . "</span>"; $str_comment

我想将MySql结果中的日期格式化为这种格式(代码是我在网站其他地方使用的,而不是我试图使用的实际代码,我只想要这种格式)

我在网站的其他地方做过,但不知道如何格式化以下结果。它是for循环的一部分,$str_注释最终得到响应,显示带有用户名和注释日期的注释列表

$str_comments .= "<span class='comment'>" . mysql_result($result, $j, 'comment') . "</span>";
$str_comments .= " by " . mysql_result($result, $j, 'username');
$str_comments .= " on " . mysql_result($result, $j, 'comm_date') . "</br><br/>";
$str\u注释=“”。mysql_result($result,$j,'comment')。"";
$str_注释=“按”。mysql_result($result,$j,'username');
$str_注释=“on”。mysql_result($result,$j,'comm_date')。“

”;
任何指点都将不胜感激。

不仅仅是:

$str_comments .= "<span class='comment'>" . mysql_result($result, $j, 'comment') . "</span>";
$str_comments .= " by " . mysql_result($result, $j, 'username');
$str_comments .= " on " . date("j F, Y", strtotime(mysql_result($result, $j, 'comm_date'))) . "</br><br/>";
$str\u注释=“”。mysql_result($result,$j,'comment')。"";
$str_注释=“按”。mysql_result($result,$j,'username');
$str_注释=“on”。日期(“jf,Y”,strotime(mysql\u result($result,$j,'comm\u date'))。“

”;
它不应该仅仅是:

$str_comments .= "<span class='comment'>" . mysql_result($result, $j, 'comment') . "</span>";
$str_comments .= " by " . mysql_result($result, $j, 'username');
$str_comments .= " on " . date("j F, Y", strtotime(mysql_result($result, $j, 'comm_date'))) . "</br><br/>";
$str\u注释=“”。mysql_result($result,$j,'comment')。"";
$str_注释=“按”。mysql_result($result,$j,'username');
$str_注释=“on”。日期(“jf,Y”,strotime(mysql\u result($result,$j,'comm\u date'))。“

”;
你不会相信我已经逃避了多少。谢谢你快速而简单的回答。你不会相信我已经逃避了多少。谢谢你快速简单的回答。