我已使用CURRENT_TIMESTAMP
将当前日期和时间添加到我的数据库中。当前时间和日期
然而,当我赞同此日期/时间它显示在下面的格式
2013年10月4日13时53分47秒
有没有办法来此格式更改为
2013年4月10日13:53
由于
我已使用CURRENT_TIMESTAMP
将当前日期和时间添加到我的数据库中。当前时间和日期
然而,当我赞同此日期/时间它显示在下面的格式
2013年10月4日13时53分47秒
有没有办法来此格式更改为
2013年4月10日13:53
由于
如果你使用MySQL,您可以更改显示日期的方式与DATE_FORMAT()
SELECT column1,
column2,
date_format(date_column, '%d-%m-%Y %h:%i') as formatted_date,
othercolumn
from blogposts
,您可以选择您的日期包裹在DATE_FORMAT(日期格式)。
点击此处了解详情:
尝试strf_time()。如果它不起作用,你总是可以使用explode()这个字符串。
<?php
$datefromDB;
$dateyourequired = date('Y-m-d H:i', strtotime($datefromDB));
echo $dateyourequired;
?>
请https://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#看看了'Date_format'功能,文档function_date格式。另外,在提出问题之前,请进行更多的研究工作,这可以很容易地被Google搜索到。 – dirkk