I want to get reaming days to go particular date so i am trying to detection of particular date with today date. but this not working here is my code If the date is next m
Your code
date1=27/5/2012
Actually means 27 divided by 5 divided by 2012. It is equivalent to writing
date1 = 0.0026838966202783303
date1 will be a number, and this number has no getDate
method.
If you declared them as actual date objects instead
var date2 = new Date(2012, 3, 19);
var date1 = new Date(2012, 4, 27);
You would be able to perform
var diff = date1 - date2;
This would give you the difference in milliseconds between the two dates.
From here, you could calculate the number of days like so:
var days = diff / 1000 / 60 / 60 / 24;