I’m using calendar from Yahoo UI as follows:
calDate = (calDate.getMonth() + 1) + ‘/’ + calDate.getDate() + ‘/’ + calDate.getFullYear();
This displays a MMDDYYYY format.
I want to change this format to YYYY-MM-DD so that I can insert it into a MySQL database. I changed the code to:
calDate = calDate.getFullYear() + ‘-‘ + (calDate.getMonth() + 1) + ‘-‘ + calDate.getDate();
It worked but the problem is now that when I want to change the selected date the calender doesn’t display the date and instead shows NAN.
You should change the format of the date just before it is inserted on the server side, let the client side have the format that it wants, and change the date around later.