In this section, we are going to determine the difference between two dates.
getFullYear()-This method return the current year.
Math.ceil()- This method returns the rounded number to the nearest integer.
Following code calculate the difference between two dates in days:
Here is the code:
var today=new Date()
var date=new Date(today.getFullYear(), 2, 11)
document.write("Today's date is :"+today+"<br>");
document.write("Another date is :"+date+"<br>");
document.write("Difference between two dates is :"+
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles