[Javascript] Add 10 working days.

BEKIM BACAJ trojani2000 at hotmail.com
Tue Sep 24 22:59:05 CDT 2002


Well,
very nice solution. Fast and creative - I like that!
thank's for repply. (keep on the good work, it will pay back:)


>From: Andrew Dunn <andrew at d2k.com.au>
>Reply-To: javascript at LaTech.edu
>To: "'javascript at LaTech.edu'" <javascript at LaTech.edu>
>Subject: RE: [Javascript] Add 10 working days.
>Date: Wed, 25 Sep 2002 13:36:04 +1000
>
>I made my own solution to the problem, here is the function:
>
>		function addWorkingDays(myDate,days) { //myDate = starting
>date, days = no. working days to add.
>			var temp_date = new Date();
>			var i = 0;
>			var days_to_add = 0;
>			while (i < (days)){
>				temp_date = new Date(myDate.getTime() +
>(days_to_add*24*60*60*1000));
>				//0 = Sunday, 6 = Saturday, if the date not
>equals a weekend day then increase by 1
>				if ((temp_date.getDay() != 0) &&
>(temp_date.getDay() != 6)){
>					i+=1;
>				}
>				days_to_add += 1;
>			}
>			return new Date(myDate.getTime() +
>days_to_add*24*60*60*1000);
>		}
>
>
>
>-----Original Message-----
>From: BEKIM BACAJ [mailto:trojani2000 at hotmail.com]
>Sent: Wednesday, 25 September 2002 11:40 AM
>To: javascript at LaTech.edu
>Subject: Re: [Javascript] Add 10 working days.
>
>
>If I understood the problem correctly, you have to extract the weekends or
>ad the number of days that fallitno the weekend of this 10 day 
>prolongation.
>
>The number wary from 2 - 4 so you have to find out what day of the week the
>user entered the textbox so you can decide how many days to add. (hollyday
>date may also cause some additional probs)
>this would be all for now. Cheers!
>
>
> >From: Andrew Dunn <andrew at d2k.com.au>
> >Reply-To: javascript at LaTech.edu
> >To: "'javascript at LaTech.edu'" <javascript at LaTech.edu>
> >Subject: [Javascript] Add 10 working days.
> >Date: Wed, 25 Sep 2002 11:13:04 +1000
> >
> >I need to add 10 working days to a date the user enters in to a text
> >box.
> >At
> >the moment I'm using this function:
> >
> >function addDays(myDate,days) {
> >			return new Date(myDate.getTime() +
> >days*24*60*60*1000);
> >		}
> >
> >This adds the number of days, but it doesn't exclude weekends. Anyone
> >have any suggestions for this?
> >
> >Thanks.
> >_______________________________________________
> >Javascript mailing list
> >Javascript at LaTech.edu
> >https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
>
>_________________________________________________________________
>Join the world's largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




More information about the Javascript mailing list