使用php将数据从datepicker插入数据库 [英] Insert data from datepicker in database using php
本文介绍了使用php将数据从datepicker插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我无法解决它,所以我的脚本:
I have a problem and I can't resolve it, So my script:
<script>
$(document).ready(function() {
$("#datepicker").datepicker({
format: 'dd-mm-yy'
});
})
我的html:
My html:
<div class="form-group">
<label>Date:</label>
<input class="form-control marg-left-10" name="date" type="text" id="datepicker">
</div>
我的php:
$date = date('dd-mm-yy', strtotime($this->input->post['date']));
但日期没有插入,在我的数据库中日期看起来像这样:0000-00- 00
But the date doesn't insert, in my database the date look like this : 0000-00-00
帮助我
推荐答案
p>
Use the appropriate format
//converting one date format into another
$date = date('Y-m-d', strtotime($this->input->post['date']));
这篇关于使用php将数据从datepicker插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文