在输入类型日期显示日期从PHP数据库

时间:2018-06-28 09:21:23

标签: php html5

<label class="w3-text-teal"><b>Date Of Birth</b></label>
<input class="w3-input w3-border w3-light-grey" type="date" value="<?php echo strftime('%Y-%m-%d',strtotime($row['date_of_birth'])); ?>" name="dob" required>

以上是我的代码,我想在输入类型date属性中获取出生日期的数据库值。
在此先感谢:)

1 个答案:

答案 0 :(得分:0)

请使用yyyy-mm-dd格式作为值。您拼写错误的strftime函数应该是strtotime

<label class="w3-text-teal"><b>Date Of Birth</b></label> <input class="w3-input w3-border w3-light-grey" type="date" value="<?php echo strtotime('%Y-%m-%d',strtotime($row['date_of_birth'])); ?>" name="dob" required>
相关问题