Focal Point
[SOLVED] how to find First Monday and Last Monday of the Month

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8137015296

February 05, 2020, 09:49 AM
FOCdeveloper
[SOLVED] how to find First Monday and Last Monday of the Month
Hello

I have a routine that calculates business days in a week..
How would I find First Monday of the Month and Last Monday of the Month ? Is there a function available for this..

Would appreciate much if someone can share this
Thanks

This message has been edited. Last edited by: FP Mod Chuck,


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
February 05, 2020, 09:56 AM
BabakNYC
What's the format of your date field?

https://infocenter.information...rce%2Fdatetime11.htm


WebFOCUS 8206, Unix, Windows
February 05, 2020, 11:01 AM
FOCdeveloper
Thank you BabakNYC .. we have a launch page where user enters the mm yy
Launch Page gives begin and end date 12/01/2019 - 12/31/2019


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
February 05, 2020, 12:05 PM
BabakNYC
Take a look at the link above for DATEMOV syntax.


WebFOCUS 8206, Unix, Windows
February 05, 2020, 05:35 PM
Edward Wolfgram
You can try this:
-DEFAULTS &1 = &YYMD.EVAL
DEFINE FILE CAR
CURDAY/A8YYMD WITH COUNTRY = '&1';
AMON/A6YYM = EDIT(CURDAY,'999999') ;
IMON/YYM   = AMON ;
INEXTMON/YYM = IMON + 1 ;
FIRSTDAY/YYMD = IMON;
FIRSTDOW/I2  = FIRSTDAY - ((INT(FIRSTDAY/7))*7) ;
FIRSTMON/YYMD  = IF FIRSTDOW THEN (7-FIRSTDOW) + FIRSTDAY
                ELSE FIRSTDAY ;
LASTDAY/YYMD = INEXTMON;
LASTNEW/I5   = LASTDAY ;
LASTDOW/I2  = LASTDAY - ((INT(LASTDAY/7))*7) ;
LASTMON/YYMD  = IF LASTDOW THEN ((7-LASTDOW) + LASTDAY) - 7
                ELSE LASTDAY - 7;
END
TABLE FILE CAR
PRINT CURDAY IMON FIRSTMON LASTMON
IF RECORDLIMIT EQ 1
END
-RUN
-EXIT



>>ex test 202002

 PAGE     1
 
 
 CURDAY      IMON     FIRSTMON    LASTMON                                      
 ------      ----     --------    -------                                      
 2020/01/00  2020/02  2020/02/03  2020/02/24



IBI Development
February 11, 2020, 03:44 PM
FOCdeveloper
Thanks Edward Wolfgram


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7