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))}}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了