我使用的是Laravel5.2以及LaravelCollective表单和html助手。
我的数据库中有一个名为fixture_date的字段,其类型为datetime。
在我看来,我使用的是
{{ Form::label('fixture_date', 'Date:') }}
{{ Form::date('fixture_date', \Carbon\Carbon::now()) }}这只会生成一个日期选择器,并在提交时将2017-01-12 00:00:00输入数据库。
如果我将视图更改为
{{ Form::label('fixture_date', 'Date:') }}
{{ Form::time('fixture_date', \Carbon\Carbon::now()) }}我得到了一个时间选择器,但当我提交时,我会得到一个错误,因为数据丢失了(日期部分)
有没有办法得到一个日期时间选择器在那里为该字段,因为我需要它的创建和更新。
谢谢
发布于 2017-01-14 21:49:14
尝试使用可用的格式方法:
默认情况下,{{ Form::time('fixture_date', Carbon\Carbon::now()->format('H:i')) }}作为时间字段使用此24小时时间格式。
https://stackoverflow.com/questions/41650575
复制相似问题