Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to make from the users End time add 30 mintues on an and on an on and display time
C#
function() {

           var toTime = new Date(result2);

           while (true) {

               var toTime30 = new Date(toTime.getTime() + toTime.getTimezoneOffset() *30 * 1000);
               var toTime60 = new Date(toTime30.getTime() + 30 * 60 * 1000);

               var addMin = toTime30 + "" + toTime60;


                   alert(addMin);
                   break;

           }

Right now the code only adds first for ex 02:00 to 02:30 how could i do so it keeps adding 30 minutes to the time?
Posted

The problem that your while end after first time is because you have a break command in your while. So you should remove this line of code.
 
Share this answer
 
Have the break inside some condition (such as 100 iterations or midnight or something) and then it will break only when you get to the condition.

Than again, you should put that condition in the while instead of having while (true).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900