在laravel视图页面中更改日期格式 [英] change the date format in laravel view page
本文介绍了在laravel视图页面中更改日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改从数据库中获取的日期格式.
现在我得到了2016-10-01 {{$user->from_date}}
.我想在laravel 5.3中更改格式'd-m-y'
I want to change the date format which is fetched from database.
now I got 2016-10-01{{$user->from_date}}
.I want to change the format 'd-m-y' in laravel 5.3
{{ $user->from_date->format('d/m/Y')}}
推荐答案
尝试一下:
date('d-m-Y', strtotime($user->from_date));
它将日期转换为d-m-Y
格式.
注意::该解决方案是适用于php及其任何框架的常规解决方案.对于特定于Laravel的方法,请尝试使用 Hamelraj提供的解决方案.
Note: This solution is a general solution that works for php and any of its frameworks. For a Laravel specific method, try the solution provided by Hamelraj.
这篇关于在laravel视图页面中更改日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文