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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month Number

Status
Not open for further replies.

kausmail

Programmer
Apr 12, 2011
7
US
I have FromDate and ToDate paramersts on my report. How to find month numbers from fromDate to Todate? e.g.
User entered from date as 5/6/2010 and to date as 12/30/2010; then I want 5,6,7,8,9,10,11,12 in an array.

Thanks in advance...
 
Create a formula like this:

numbervar st := month({?FromDate});
numbervar end := month({?ToDate});
numbervar array mos;
numbervar i;
numbervar j := end-st+1;
for i := 1 to j do (
redim preserve mos[j];
if st+i=1 <= 12 then
mos := st+i-1 else
if st+i-1 <= 24 then
mos := st+i-13 else
if st+i-1 <= 36 then
mos := st+i-25 //etc.
);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top