将数据库时间戳转换为日期



我有一个这种格式的数据库时间戳2016-06-01 11:46:00我想将其转换并回显为这种格式Wed. 01-06-2016。我尝试了很多,但没有理想的结果。有什么想法吗?

非常感谢,它奏效了!如果我想以天或几周为单位了解今天和过去日期之间的差异,我想我会使用 date_diff .究竟是怎么回事?

只需使用 datestrtotime

$time = '2016-06-01 11:46:00';
echo date("D. d-m-Y", strtotime($time)); //Wed. 01-06-2016

更新:

$grk = array("Tet"); // complete the rest of the array
$eng = array("Wed"); // complete the rest of the array
$time = '2016-06-01 11:46:00';
$date = date("D. d-m-Y", strtotime($time));
echo str_replace($eng, $grk, $date);
$time = '2016-06-01 11:46:00';
echo date("D. d-m-Y", strtotime($time)); //Wed. 01-06-2016

最新更新