I've an input text box with a date-picker, when the user selects a particular date, the date say 09-Dec-2014 gets applied to the input text box. On submit, I want the date to be passed to the server in yyyymmdd format say 20141209. So how to convert the date format in javascript?
var date = new Date(Date.parse('09-Dec-2014'));
Above code gives me 'Invalid date'.
Searched the net for solution but was not able to find for my problem.
Can someone help me out?
Thanks.
var date = '09-Dec-2014'.split("-");
var newDate=date[2]+date[1]+date[0];
Something really quick may be, split and generate your own.