Tuesday, 26 June 2012

Substract date in js

 
    var now = new Date();
    //It will give the current date and time in default format.
 
    var future = new Date(now .setHours(now .getHours()+24));
    //in this we add 24 hours in present time .
 
    var diff = Math.abs(future - now);
 
   diff in milliseconds.

No comments:

Post a Comment