I normally use something like this. For a year starting March 1st, it will perfectly account for leap years and anything else.
SET VAR vDate1 DATE = '01/01/2003' SET VAR vDate2 DATE = (ADDYR(.vDate1,1) - 1) SHO VAR vDate2 R>02/29/2004 If you want a quarter, (ADDMON(.vDate1,3) - 1) "Kenny Camp" <[EMAIL PROTECTED]> wrote: >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 >> > >> >> >> > > -- Albert Berry Full Time Consultant to PSD Solutions 350 West Hubbard, Suite 210 Chicago, IL 60610 312-828-9253 Ext. 32 __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

