Trying to format the date in jQuery datepicker

I’m new to Javascript so this might be a real easy fix. But I’m trying to figure out a way to reformat the date that jQuery’s datepicker pulls up. I want it formatted to yyyy-mm-dd so I can move it with PHP into my MySQL database. This seems like it will be the easiest way, there’s even a couple of bits within the jQuery website about how to do this. They provide a code, but I can’t figure out how or where to apply the code. I’ve tried both within and just underneath the call script on the page, but nothing.

Here’s one of the codes that I’ve found listed over the web:


$("selector).datepick({dateFormat: 'DD, MM d, yyyy', altField: '#isoDate', altFormat: 'yyyy-mm-dd'});


This is what jQuery’s site has listed:


$.datepicker.formatDate('yy-mm-dd', new Date(2007, 1 - 1, 26));


Am I missing something here?

The format date example in the jQuery UI documentation might be useful for you here, and for further details on how to handle the dateFormat part, open up the Options tab below the demo and click on dateFormat