dongshi4773 2014-11-30 08:41
浏览 63
已采纳

将TimeStamp从数据库转换为Day laravel [重复]

This question already has an answer here:

I want to convert a date I queried from the database, to explain it further here is my code on views.

    @foreach($myquery as $mydate)
    <tr>
        <td>{{ Date::createFromFormat('l',$mydate->logon)}}</td>
        <td></td>
        <td></td>
        <td></td>
    </tr>
    @endforeach

what I want to output is just the Day, Example: mondays, fridays etc $mydate->logon outputs 2014-11-25 10:28:09

</div>
  • 写回答

1条回答 默认 最新

  • duanluanlang8501 2014-11-30 10:08
    关注

    You can use the date function to get the name of the day, after converting your time into Unix Timestamp . For converting your time to Unix timestamp you can use

    strtotime

    use the 'l' modifier, for the full textual representation when using the date function . so in laravel you can get desired output with

    {{date('l',strtotime($mydate->logon))}}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码