$(function() {
    $('#defaultInline').datepick({
       dateFormat: 'yyyy-mm-dd',
       onSelect: showDate
    });
    function showDate(date) {
       var dates2 = $('#defaultInline').datepick('getDate');  // this works 
       var dates3 =  $.datepick.formatDate('yyyy-mm-dd',dates2) /// this give an error 
    alert('The date chosen is ' + dates2);
    }
});
Alert (dates2) works but dates 3 gives an error.....any ideas ? basically i want to just get the date from an inline calender in a particular format....right now it shows up as Tue Oct 30 2012 12:00:00 GMT+0530 (India Standard Time) but all i want is 2012-10-30 ....
the error i get is : TypeError: g.getFullYear is not a function
 
     
    