Hi Guys,
In this article we will see how we can Calculate first and last date of a month from any date.
Code:-
            action("Calculate Date")
            {
                ApplicationArea = All;
                trigger OnAction()
                var
                    FirstDate: Date;
                    LastDate: Date;
                begin
                    FirstDate := CalcDate('-CM', Today);
                    LastDate := CalcDate('CM', Today);
                    Message('First Date >> ' + Format(FirstDate) +
                    '\' + 'Last Date >> ' + Format(LastDate));
                end;
            }
Output:-  On a click of  Calculate Date action button, output will be :-
Note:- You can replace Today with any date as per the requirement.
Thanks!! I hope this will help you :)

Comments
Post a Comment