cdemott33
asked on
Help needed to loop through date array
I have an array that I need to loop though and display something like this on my webpage:
January
- 1/2/2012
- 1/14/2012
February
- 2/19/2012
April
- 4/20/2012
July
- 7/4/2012
The array looks like this
0 = 1/2/2012
1 = 1/14/2012
2 = 2/19/2012
3 = 4/20/2012
4 = 7/4/2012
It's a classic ASP/VBScript page. I need to print the full month's name followed by the dates that fall within that month. Can someone provide me with a code snippet that will give me the output I'm looking for. I'm lost on how I can achieve this. Thanks!
January
- 1/2/2012
- 1/14/2012
February
- 2/19/2012
April
- 4/20/2012
July
- 7/4/2012
The array looks like this
0 = 1/2/2012
1 = 1/14/2012
2 = 2/19/2012
3 = 4/20/2012
4 = 7/4/2012
It's a classic ASP/VBScript page. I need to print the full month's name followed by the dates that fall within that month. Can someone provide me with a code snippet that will give me the output I'm looking for. I'm lost on how I can achieve this. Thanks!
ASKER
Works perfect! Thank you. Question though... just so I understand. In this block of code...
For Each strMonth In objMonths.Keys()
Response.Write (strMonth & objMonths.Item(strMonth) & "<br /><br />")
Next
It's the first time the variable strMonth is declared. Does the objMonths.Keys() assign this variable the name of the month? Sorry, I'm just not sure how this works and I want to learn.
For Each strMonth In objMonths.Keys()
Response.Write (strMonth & objMonths.Item(strMonth) & "<br /><br />")
Next
It's the first time the variable strMonth is declared. Does the objMonths.Keys() assign this variable the name of the month? Sorry, I'm just not sure how this works and I want to learn.
What is happening is that the strMonth variable represents an item in the objMonths.Keys() object.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you so much for the detail explanation. It really helped me understand your script. It's people like you that keep me a member of Experts Exchange. Great Job!
Open in new window