我有一个问题,我不能解决它,所以我的脚本:
 <script>
 $(document).ready(function() {
     $("#datepicker").datepicker({
         format: 'dd-mm-yy'
     });
 })我的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
请帮帮我
发布于 2014-08-25 17:22:18
正如你所说的
    My php:
$date = date('dd-mm-yy', strtotime($this->input->post['date']));
But the date doesn't insert, in my database the date look like this : 0000-00-00问题是,您以dd-mm-YYYY格式获取日期,而在myswl上,它被保存为YYYY-mm-dd格式
所以最好是将一个列作为varchar,然后将日期另存为'dd-mm-YYYY‘作为字符串
或者,如果您想使用mysql日期格式,则将日期转换为YYYY-mm-dd格式
这可以像这样做
$old_date = $this->input->post['date'];
$o_date_time = strtotime($o_date);
$date = date('Y-m-d', $o_date_time);https://stackoverflow.com/questions/25482581
复制相似问题