I have a simple textfield with the type defied to be as date which attached with a jquery datepicker()
. Now i have set the dateFormat()
to be dd-mm-yy
. All this works fine. But as i know MySql requires date in yyyy-mm-dd
. So i was just wondering if i can convert that date format either using php or javascript to enter into the database.
E.g var date = $('#order_date').val();
gives value 26-2-2012. I need to convert this into 2012-02-26.
Note: There is also a 0
being added to the month.