On Monday, 7 January 2013 10:46:00 UTC-5, Daniel Klein wrote:
>
> That being said, rather than do the calculation, it might be better
> (simpler) to use an external table.
>
>
Why an external table? The simple calculation below will give one the 3rd
Monday for any given month/year. We know that the maximum date of any 3rd
Monday is the 21st of the month, so we work with that as follows.
PROMPT ''
CRT 'YEAR (YYYY) ':
INPUT YEAR
IF YEAR = '' THEN STOP
CRT 'MONTH (MMM) ':
INPUT MONTH
IF MONTH = '' THEN STOP
TARGET = ICONV('21':MONTH:YEAR,'D4')
DAY.OF.WEEK = OCONV(TARGET,'DW')
THIRD.MONDAY = TARGET - (DAY.OF.WEEK - 1)
CRT OCONV(THIRD.MONDAY, 'D2')
A shorter version for the current date.
TODAY = DATE()
YEAR = OCONV(TODAY,'DY')
MONTH = OCONV(TODAY,'DMA')
TARGET = ICONV('21':MONTH:YEAR,'D4')
DAY.OF.WEEK = OCONV(TARGET,'DW')
THIRD.MONDAY = TARGET - (DAY.OF.WEEK - 1)
CRT OCONV(THIRD.MONDAY, 'D2')
BTW, the above is for D3, but I think it should work for jBASE either
unchanged or only needing a minor tweak
Kevin Powick
--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en