dongzhuohan7085 2018-10-25 19:59
浏览 23
已采纳

使用php datetime方法无法转换为12小时制

For some reason I can' make this into 12 hour time format. It comes up as Lead At: 5/26/2018 14:25

@if(!empty($user['lead_at']))
<label for="lead_at" id="lead_at">Lead At: {{ Format::shortDateTime($user['lead_at']) }}</label>
@endif
  • 写回答

1条回答 默认 最新

  • duanqinqian5299 2018-10-25 20:07
    关注

    Laravel comes with Carbon

    You can do

    <label for="lead_at" id="lead_at">Lead At: {{ \Carbon\Carbon::parse($user['lead_at'])->format('d/m/Y h:i:s a'); }}
    

    The format is up to you. Read about the options here: http://php.net/manual/en/function.date.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?