【发布时间】:2018-11-20 20:42:15
【问题描述】:
我有这个代码,
<div class="form-group">
<label class="col-sm-2 control-label" for="date-created">Date Created</label>
<div class="col-sm-10">
@if (isset($post->created_at))
<input type="date" class="form-control" id="date-created" name="created_at" value="{{ date('d/m/Y', strtotime($post->created_at)) }}">
@else
<input type="date" class="form-control" id="date-created" name="created_at" placeholder="Enter the date the blog post created">
@endif
</div>
</div>
我要做的是,将数据库中的日期显示到允许用户编辑日期的类型的输入框。
但在浏览器上渲染时会显示
最好的办法是什么?
这可能是一个简单的问题,但我找不到一个简单的解释来解释为什么它对我不起作用。
【问题讨论】:
-
尝试将格式从:
date('d/m/Y',...更改为date('d-m-Y',。 stackoverflow.com/questions/40038521/… -
还是不行....
-
您是否首先尝试使用默认的
<input type="text">来确认这是否只是type="date"字段格式的问题,或者您的模板是否确实有问题?