Month Names from a range...

# Thread: Month Names from a range...

1. Senior Member
Join Date
Dec 1969
Posts
175

## Month Names from a range...

I have two fields "period_from" and "period_to" I need to display all the months coming in this range<BR>eg:<BR>period_from = 3/15/2002<BR>period_to = 7/21/2002<BR><BR>The result should be March, April, May, June, July<BR><BR>I feel it should be something like (7-3)+1 That is 5 Months, Then display the first 5 months starting from 3????<BR><BR>Please help<BR><BR>Thanx

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Month Names from a range...

For i = Month(period_from) + 1 to Month(period_to)<BR> Response.Write MonthName(Month(i))<BR>Next<BR><BR>should give you your results.<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
1,849

## RE: Month Names from a range...

for i = month(period_from) to month(period_to)<BR> &#039;find your month number here and print date<BR>next<BR><BR>Now, this does not account for months that start in a previous year...<BR><BR>IE december to january is a 12 to 1 month, you&#039;d have to do other checking for that...<BR><BR>-- Whol

4. Senior Member
Join Date
Dec 1969
Posts
339

## RE: Month Names from a range...

try datediff<BR><BR>http://www.devguru.com/Technologies/vbscript/quickref/datediff.html

5. Member
Join Date
Dec 1969
Posts
52

## RE: Month Names from a range...

&nbsp;<BR>do until period_from &#062; period_to<BR> period_from = dateserial(year(period_from), month(period_from)+1, day(period_from))<BR><BR>loop<BR><BR>That will take care of year changes.

6. Senior Member
Join Date
Dec 1969
Posts
339

## whoa! wrong info i say! darn! i hate coffee now!

!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•