I have a senario where i have to parse two dates for example start date and end date.
var startdate = \'02/01/2011\';
var enddate = \'31/12/2011\';
If you want to parse a date without local differences, use the following, instead of Date.parse()
:
var enddate = '31/12/2011'; //DD/MM/YYYY
var split = enddate.split('/');
// Month is zero-indexed so subtract one from the month inside the constructor
var date = new Date(split[2], split[1] - 1, split[0]); //Y M D
var timestamp = date.getTime();
See also: Date
According to this
dateString A string representing an RFC822 or ISO 8601 date.
I've tried your code and I also get NaN
for the end date, but if i swap the date and month around, it works fine.