I have a php array of dates ($fdates) which outputs as
array (size=1) 0 => string '2013/08/23' (length=10)
I need to change this to a Javascript array in this format
var array = ["2013-09-14","2013-09-15","2013-09-16"]
using json_encode i get ["2013V09V14"]
How do i change the format into the format above (its for beforedate in jquery date picker..
<?php
var_dump( $fdates ); // test query
echo json_encode($fdates);
?>
<script type="text/javascript">
var array = <?php echo json_encode($fdates); ?>;
jQuery(document).ready(function() {
jQuery('#MyDate').datepicker({
beforeShowDay: function(date){
var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
return [ array.indexOf(string) == -1 ]
}
});
});
</script>