I have the the following date format in my jQuery. But when I try to do a dateparse using the datepicker it states that the object is not supported. I take it that the date format is incorrect.
The following line works fine in Chrome and Firefox but not in IE. I get NaN returned as a result:
var newdate = getNewDate(value);
function getNewDate(dateValue) {
var newDate = new Date(dateValue);
var cDate = newDate.getDate();
var cMonth = newDate.getMonth() + 1; // have to add one as January starts from 0
var cYear = newDate.getFullYear();
return cDate + "/" + cMonth + "/" + cYear;
};
When I do getDate
it returns NaN
for each of the gets, i.e. getDate
, getMonth
and getFullYear
.
All I require is to get the date and return in this format dd/mm/yyyy
Any ideas?