im having a hard time in inserting the selected date date in date picker when im selecting earlier year the value that inserting to my data base is the current date
heres my code
bdate
<link href="jqueryui/css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<script src="jqueryui/js/jquery-1.9.1.js"></script>
<script src="jqueryui/js/jquery-ui-1.10.3.custom.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:-1",
dateFormat: 'yy-mm-dd',
defaultDate: '01-01-1950'
});
});
</script>
<style>
/*datepicker hack*/
#ui-datepicker-div { font-size: 12px; }
</style>
<tr>
<td>Birthday*</td>
<td><input id="datepicker" name="bdate" <?php if(isset($bdate)){ echo 'value="'.$bdate.'"';}?> /></td>
</tr>
thanks
The default date is in the wrong format, it should be yy-mm-dd
, so you should have it set to 50-01-01
.
Also the earliest year that datepicker will go to is 1963.