Increment Date in Javascript

Following is the function to increment date by one day in javascript.


   function IncrementDate(date) {         
         var tempDate = new Date(date);
            tempDate.setDate(tempDate.getDate() + 1);
            return tempDate;
   }  


Function calling...


 var currentDate = new Date();
 var IncrementedDate =  IncrementDate(currentDate);


Here we use the setDate method of Date variable to increment date.

For exploring more in programming on this blog click here
13 Feb 2013

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Top