duanlaofu4108 2018-09-03 01:53
浏览 35
已采纳

在codeigniter中更改日期格式

I have this view

<?PHP 
    $no = 0;
    foreach ($dt as $key => $row) { 
        $no++;
    ?>
<td style="text-align:center;"> <?=$row->TANGGAL_KADALUARSA;?> </td>

with result

21/11/2018  0:00:00

What I want is to change the format into

21 December 2018
  • 写回答

5条回答 默认 最新

  • duancheng6500 2018-09-03 04:05
    关注

    Try this

    $date = "21/11/2018  0:00:00";
    echo date('d F Y', strtotime(str_replace('/', '-', $date)))
    

    PHPFiddle

    FYI: with this formation you can use this for saving in DB date which has / and MySQL won't throw an error with invalid date format.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?