日期未按 laravel 中指定的那样工作
Date not working as specified in laravel
我目前正在我的项目中做一个项目我想显示 date/month/only 年份的两位数但我不能做 this.The 日期在数据库中并且它在 yyyy-mm-dd H-i-s
格式这是我的代码
<p class="text-lg">Meeting request sent to
<strong>{{ (!empty($provider_detail->first_name)) ? $provider_detail->first_name : '' }} {{ (!empty($provider_detail->last_name)) ? $provider_detail->last_name : '' }}</strong></br>
{{ (!empty($booking->booking_date)) ? date("y/m/d",$booking->booking_date) : '' }}
显示错误。
ErrorException in 32beed24f6cd306408a9dd85ca2812a4630c92ec.php line 20:
A non well formed numeric value encountered (View: /home/devtqdyp/public_html/syncopp/resources/views/frontends/booking-successful.blade.php)
请帮我解决这个问题。
谢谢
bookig_date是数值还是字符串?
尝试改变
date("y/m/d",$booking->booking_date)
至
date("y/m/d", strtotime($booking->booking_date))
如果您的日期格式如您所说,即 16/10/25
即 yy/mm/dd
那么您的日期需要重新格式化为 -
而不是 /
for strtotime()
正确地将其解释为像这样的欧洲日期
date('y/m/d',strtotime(str_replace('/','-',$booking->booking_date)))
我目前正在我的项目中做一个项目我想显示 date/month/only 年份的两位数但我不能做 this.The 日期在数据库中并且它在 yyyy-mm-dd H-i-s
格式这是我的代码
<p class="text-lg">Meeting request sent to
<strong>{{ (!empty($provider_detail->first_name)) ? $provider_detail->first_name : '' }} {{ (!empty($provider_detail->last_name)) ? $provider_detail->last_name : '' }}</strong></br>
{{ (!empty($booking->booking_date)) ? date("y/m/d",$booking->booking_date) : '' }}
显示错误。
ErrorException in 32beed24f6cd306408a9dd85ca2812a4630c92ec.php line 20:
A non well formed numeric value encountered (View: /home/devtqdyp/public_html/syncopp/resources/views/frontends/booking-successful.blade.php)
请帮我解决这个问题。 谢谢
bookig_date是数值还是字符串?
尝试改变
date("y/m/d",$booking->booking_date)
至
date("y/m/d", strtotime($booking->booking_date))
如果您的日期格式如您所说,即 16/10/25
即 yy/mm/dd
那么您的日期需要重新格式化为 -
而不是 /
for strtotime()
正确地将其解释为像这样的欧洲日期
date('y/m/d',strtotime(str_replace('/','-',$booking->booking_date)))