Thanks a lot for the head -ups, really appreciate your input! Will the same
formula apply for example if i was looking for Tuesday, Wednesday, Thursday
or Friday?
Thanks
On Monday, January 7, 2013 11:59:20 PM UTC+3, Kevin Powick wrote:
>
>
>
> On Monday, 7 January 2013 10:46:00 UTC-5, Daniel Klein wrote:
>>
>>
>> 0001 today = DATE()
>> 0002 mth = OCONV(today, 'DM')
>> 0003 yr = OCONV(today, 'DY')
>> 0004 first_of_month = ICONV(mth:'-1-':yr, 'D')
>> 0005 day_of_week = OCONV(first_of_month, 'DW')
>> 0006 first_monday = first_of_month + (8-day_of_week)
>> 0007 CRT OCONV(first_monday, 'D'):' is the 1st Monday of this month.'
>>
>>
> That code actually doesn't work in all cases. For example, try April 2013
>
> The following should give the 1st through 4th Mondays for any given month
> and year:
>
> TODAY = DATE()
> YEAR = OCONV(TODAY,'DY')
> MONTH = OCONV(TODAY,'DMA')
>
> FIRST.OF.MONTH = ICONV('1':MONTH:YEAR,'D4')
> DAY.OF.WEEK = OCONV(FIRST.OF.MONTH,'DW')
>
> IF DAY.OF.WEEK = 1 THEN
> FIRST.MONDAY = FIRST.OF.MONTH
> END ELSE
> FIRST.MONDAY = FIRST.OF.MONTH + (8 - DAY.OF.WEEK)
> END
>
> FOURTH.MONDAY = FIRST.MONDAY + 21
>
> FOR MONDAY = FIRST.MONDAY TO FOURTH.MONDAY STEP 7
> CRT 'MONDAY = ':OCONV(MONDAY,'D2')
> NEXT MONDAY
>
> --
> 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