如何格式化 laravel 中的时间数据类型
How to format time data type in laravel
如何格式化 laravel 中的时间数据类型?请在下面查看我的代码。
型号
protected $dates = ['start_date', 'end_date', 'show_at', 'hide_at', 'created_at', 'updated_at'];
查看
{{ $promotion->show_at->format('h:i:s A') }}
来自数据库的数据(类型:时间)
23:59:59
错误
Unexpected data found. Unexpected data found.
请尝试:
{{ Carbon::parse($promotion->show_at)->format('H:i:s') }}
试试这个:
{{ date_format($promotion->show_at,"h:i:s A") }}
如何格式化 laravel 中的时间数据类型?请在下面查看我的代码。
型号
protected $dates = ['start_date', 'end_date', 'show_at', 'hide_at', 'created_at', 'updated_at'];
查看
{{ $promotion->show_at->format('h:i:s A') }}
来自数据库的数据(类型:时间)
23:59:59
错误
Unexpected data found. Unexpected data found.
请尝试:
{{ Carbon::parse($promotion->show_at)->format('H:i:s') }}
试试这个:
{{ date_format($promotion->show_at,"h:i:s A") }}