使用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']));