Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find days of week

Status
Not open for further replies.

jazzmaster111

Programmer
May 2, 2005
25
MX
Hi:

How I can know how many mondays there are between 2 dates??
 
Create a counter variable, and initialise it to 0.

Create a date object from your start date. Incremement it by 1 day. This gives you your first day to check (you didn't specify "inclusive", so I am assuming you really did mean "between").

Then do a while loop, of which the condition is the end date.

In the while loop, use the getDay method of the date object to return the day of the week, and if it is a Monday, increment your counter.

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 

Anytime - good to see you got it working.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top