douchigu1723
2018-11-29 07:22
浏览 127
已采纳

我想将一个字符串拆分为两个变量

I have selected two dates in a date range picker and stored them in one data base column but it only stores one date, like: 0000-00-00. I can't store two dates in one column so I want to split this string into two variable by hyphen (-).

This is my date range function:

<script>
   $(function () {

       //Initialize Select2 Elements
     $('.select2').select2();

     //Date range picker
     $('#bilty_date_range').daterangepicker();

     });
 </script>

This is my date insert code:

'bilty_date_range'      => date('y-m-d',strtotime($bilty_date_range)),

I am selecting the date like this: enter image description here

The backend result is like this: 11/07/2018 - 12/25/2018 .

4条回答 默认 最新

相关推荐 更多相似问题