I'm trying to get a database date value to display in the datepicker. I'm also converting from the yyyy-mm-dd database format to the datepicker format, but it's not display the value in my datepicker. If I echo the date value separately, it is displaying the correct value, but not inside the datepicker only in the form.
Here is my datepicker function.
$(document).ready(function() { //display calender
$("#datepicker").datepicker();
$('#datepicker').datepicker( 'option', { changeYear: true } );
$('#datepicker').datepicker( 'option', { changeMonth: true } );
$('#datepicker').datepicker( 'option', { yearRange: '1950:2015' } );
$( "#datepicker" ).datepicker('option', 'dateFormat' , 'dd-mm-yy');
});
input type="text" id="datepicker" name="datepicker" value="php if(isset($dob)) echo $dob;?>"
$dob
is fetched from the database and carries the correct value if echoed. Can anyone help?