Calculate Month & Quarter End Dates

You would think there would be an easy way to calculate a Month End Date or a Quarter End Date, taking into account leap years, in VB. But there isn't. This class module has methods to return the next calendar day, current or next month end date and current or next quarter end dates. All you need to do is add it to your project.

Calculate Month & Quarter End Dates
Download Source Code


This class module has a few basic methods. IsLeapYear returns True if the input year is a leap year. It checks to see if the year is divisible by 4, 100 as well as 400.

MonthEnd takes a date and returns the current month end date. If the date supplied is the month end then it will either return that date or the following month end date depending on the Skip Month End parameter.

QuarterEnd acts the same way. NextDay simply returns the date of the following day crossing month and year boundaries.

These routines are nothing fancy, they just fill a void in VB's built in functions.


To run the sample, enter a valid date then hit the Get Dates button. If the date you enter is in the middle of the month, you will get the current month end date. If it is the month end date, you will get the next month end date.

About TheScarms
About TheScarms

Sample code
version info

If you use this code, please mention ""

Email this page

© Copyright 2024 TheScarms
Goto top of page