我有一个问题要问你,我尝试但没有收到...我需要将日期插入数据库: 我的脚本:
<script>
$(document).ready(function() {
$("#datepicker").datepicker({
format: 'yyyy-mm-dd'
});
})
我的 html:
<div class="form-group">
<label>Date:</label>
<input class="form-control marg-left-10" name="date" id="datepicker">
</div>
我的 php:
$date = date('Y-m-d H:i:s', strtotime($this->input->post['date']));
数据被插入数据库:1962-12-31。 请帮助我。
最佳答案
尝试替换
$this->input->post['date']
到
$this->input->post('date')
更多信息:- https://ellislab.com/codeigniter/user-guide/libraries/input.html
关于php - 使用php在数据库中插入日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25486890/