I am using a jquery datepicker with the following format mm/dd/yyyy but I need it to be yyyy-mm-dd for the sql db so I am using this.
$date = date(\"Y-m-
put dateformat in jquery when initializing the datepicker like
$( "#id/.class" ).datepicker({dateFormat: 'yy-mm-dd'});
This format will insert on mysql db(done on client side), otherwise format it on the server side code.