How to convert the format of the javascript string to the date

advertisements

In my ajax success I am getting result.Date as "/Date(-2208967200000)/". I need to check with the following date and proceed..

How to convert the "/Date(-2208967200000)/" to "01-01-1900" for below if condition?

if (result.Date != "01-01-1900") {
....
}


You can convert result.Date into you comparison date format, same as below example

var dateString = "\/Date(-2208967200000)\/".substr(6);
var currentTime = new Date(parseInt(dateString ));
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var date = day + "/" + month + "/" + year;

After doing this.. you can compare it with other date..