Date picker help

Date picker help

Hi,

Im a newbie to jquery and wanted some help.

I have a date field which i want to be autopopulated with todays date but in the 'YY-MM-DD' format , I can get this working from user input but when i add the bold code the autopopulated date isnt in the correct format???


$(document).ready(function(){
$("#datepicker").datepicker({dateFormat: 'yy-mm-dd'});
var myDate = new Date();
var month = myDate.getMonth() + 1;
var datepicker = month + '/' + myDate.getDate() + '/' + myDate.getFullYear();
$("#datepicker").val(datepicker);});



Thanks
Matt