这是我模型中的My mutator。
protected $dates = ['closer_date','final_submission_date','start_date'];
这是一个字段,我想在字段中设置日期,从数据库中检索记录。
<input class="form-control" type="date" name="start_date" value="{{ $topic->start_date}}" id = "start_date" onkeyup = "Validate(this)" required min=<?php
echo date('Y-m-d');
?> />
使用format()
设置格式
{{ $topic->start_date->format('Y-m-d')}}
在你的代码中
<input class="form-control" type="date" name="start_date" value="{{ $topic->start_date->format('Y-m-d)}}" id = "start_date" onkeyup = "Validate(this)" required min=<?php
echo date('Y-m-d');
?> />
希望这可以帮助