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 month 27 how can i get remaining days to go
    var date2=new Date();
    var date1=27/5/2012;
    var diff = date1.getDate()-date2.getDate();
    var date_reaming = diff.getDate();
    document.write(date_reaming + 'days to go');
                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;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With