E9.2 A method to get the first and last day (in date) when the input is the month


Hi everyone,

I'm trying to find a method or a business function that is able to give me the dates of the first day and last day of the month when the input is the month. Any ideas? I couldn't find it.

Thanks in advance.


Reputable Poster
Howdy.. I do not is such a function exists but just wanted to give you a heads-up that in a leap year, February has 29 days instead of 28 so passing only the month without a Year would not be able to cover that scenario :) An that may be the reason why such a function would need to have Year as input parameter as well


Legendary Poster
Are you wanting the date as in 2/1 and 2/28 (or 2/29)? Or are you wanting the day as in Monday, Tuesday, etc.

JDEDATE date = [init date to passed month and year and nDay = 1];    //ex:  2/1/2020
int nDayBeg, nDayEnd;

nDayBeg = DayOfTheWeek(&date);   //0=Sunday, 1=Monday, 2=Tuesday, etc.
AdvanceOneMonth(&date);     //ex:  3/1/2020
AdvanceDate(&date, &date, 0, -1);   //ex:  2/29/2020
nDayEnd = DayOfTheWeek(&date);


Well Known Member
First day is easy, just change the day

// Split F3413 STRT

VA rpt_F553413CalendarMonth_MT [MT] <- mnMonth [DMTM]
VA rpt_BirthdateDay_DOBD [DOBD] <- mnDay [DMTD]
VA rpt_BirthdateYear_DOBY [DOBY] <- mnYear [DMTY]
VA rpt_Century_CTRY [CTRY] <- mnCentury [DMT#]
BC Date - Start (Julian) (F3413.0) [STRT] -> jdReturnDate [DATE01]
"1" -> cProcessingFlag [EV01]

// Make F3460 DRQJ 1st day of month

VA rpt_F553413CalendarMonth_MT [MT] -> mnMonth [DMTM]
"1" -> mnDay [DMTD]
VA rpt_BirthdateYear_DOBY [DOBY] -> mnYear [DMTY]
VA rpt_Century_CTRY [CTRY] -> mnCentury [DMT#]
VA rpt_F553413DateStart_STRT [STRT] <- jdReturnDate [DATE01]
<Blank> -> cProcessingFlag [EV01]

Last day I use this

BC Date - Start (Julian) (F3413.0) [STRT] -> jdBaseDate [BASEDJ]
"0" -> cMonthBeginEnd [MTHBGED]
VA rpt_F553413EffectiveThruD_EFFT [EFFT] <- jdEndDate [ENDDJ]
"1" -> cSuppressErrorMessage [SUPPS]