I use this idea for reports for sales for the previous years.  It even works
for leap years.

See code below.

Kenny Camp
IT Manager
Electro Enterprises
Oklahoma City, OK
-- set up dates for reports
-- OK for Leap Years 1996,2000,2004
SET DATE FORMAT MM/DD/YYYY
SET V vdate DATE=.#DATE
SET V vmonth INTEGER
SET V veomday INTEGER
SET V vyear INTEGER
SET V vyr1start DATE
SET V vyr1end DATE
SET V vyr2start DATE
SET V vyr2end DATE
SET V vyr3start DATE
SET V vyr3end DATE
SET V vyr4start DATE
SET V vyr4end DATE

SET V vmonth = (IMON(.vdate))
SET V vyear = ((IYR(.vdate))-3)
SET V vdate = (RDATE(.vmonth,1,.vyear))
SET V vdate = (.vdate -1)
SET V veomday =(IDAY(.vdate))
SET V vyear = (.vyear -1)
SET V vyr1start =(RDATE(.vmonth,1,.vyear))
SET V vyear = (.vyear + 1)
SET V vyr2start =(RDATE(.vmonth,1,.vyear))
SET V vyr1end = (.vyr2start -1)
SET V vyear = (.vyear + 1)
SET V vyr3start =(RDATE(.vmonth,1,.vyear))
SET V vyr2end=(.vyr3start -1)
SET V vyear = (.vyear + 1)
SET V vyr4start = (RDATE(.vmonth ,1,.vyear))
SET V vyr3end=(.vyr4start -1)
SET V vyear = (.vyear + 1)
SET V vdate=(RDATE(.vmonth,1,.vyear))
SET V vyr4end=(.vdate - 1)

----- Original Message ----- 
From: "J. Stephen Wills" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, December 12, 2003 9:49 AM
Subject: [RBASE-L] - Re: Day of week insert - Follow-Up : End-Of-Month


> Bill, Et Al., would anyone know of a good way (algorithm) and RB
> implementation/approach to finding the end of a series of months?  For
> example, let's say that we have a need to allow a user to create a new
YEAR,
> with 12 months (we won't worry for now whether it's Fiscal or Calendar).
We
> know that each month's first day is an (INTEGER) 1 ...
>
> Hey, wait a minute, if each month in a given period is known, and each
month
> starts with a 1, the first, as it were, then the end of the previous month
> can be derived by subtracting one date from the first, right?
>
> Anybody have any experience/insights in this area?
>
>
> Thanks,
> Steve in Memphis
>
> ----- Original Message ----- 
> From: "Bill Downall" <[EMAIL PROTECTED]>
> To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, December 11, 2003 7:07 PM
> Subject: [RBASE-L] - Re: Day of week insert
>
>
> > Define a variable
> > vWeekDayName TEXT = (TDWK(datecolumn))
> >
> > Locate the variable anywhere you like. Or, just define the picture
format
> of
> > the column to show the weekday.
> >
> > Bill
> >
> >
> >
> > On Thu, 11 Dec 2003 20:13:45 -0500, Steve Breen wrote:
> >
> > >I appreciate this information. How would you include this as an
> > expression
> > >in a report?
> >
> > >I was thinking in simple terms: day = (TDWK(datecolumn))
> >
> > >But I have my doubts that this will work. I believe I am thinking in
the
> > >wrong direction here
> >
>
>
>

Reply via email to