0

I want to convert mysql date to datetimepicker, because datetimepicker has different format from mysql and this makes the datepicker readonly and I can't select another date.

$(function() {
        $('#date').datetimepicker({
            pickTime: false,
        });
    });

mysql: y-m-d
datetimepicker:mm/dd/yy

EDIT controller

 public function edit($id) {
        $values = DB::table('insur_docs')->where('car_id', $id)->get();
        return View::make('pages.insur_docs', array(
                    'values' => $values,
        ));

view

{{ Form::label('authoriz', Lang::get('messages.authorization').'*', array('class'=>'control-label col-lg-4')) }}            
                <div class="col-lg-8">
                    {{ Form::text ('authoriz', isset($v->authoriz) ? $v->authoriz : '' , array(
                                'class' => 'form-control', 'id' => 'date')) 
                    }}
                </div>

I get data from controller and pass to the view

1 Answers1

0

Change the format of the dateTime picker like so:

$(function() {
        $('#date').datetimepicker({
            dateFormat: 'mm/dd/yy'
        });
    });

Take a look at this SO.

Community
  • 1
  • 1
vlio20
  • 8,955
  • 18
  • 95
  • 180
  • From where do you get your data? How are u passing it to you date picker? – vlio20 Jun 23 '14 at 14:07
  • just edited my question, i get date from controller pass to the view and it displays it as mysql format. In this way datepicker doesnt select any value because the change in format –  Jun 23 '14 at 14:39
  • can you post the html code which this php (I believe laravel) producing, just copy & paste the relevant part of the page source. – vlio20 Jun 23 '14 at 14:43