Search Amazon:

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

Discussion

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.

Instructions

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.

Sign In
  User Id 
  Password 


Submit Your Own Code and Articles




About TheScarms
About TheScarms

Ask me your programming questions

I read every email and answer all I can.

User Feedback: Be the first to add a comment! Items to Show:     

     
You must log in to post feedback.
Comment:    
 

If you use this code, please mention "www.TheScarms.com"

Email this page


TheScarms AppSentinel lets you securely copy protect and create evaluation versions of your software

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Get your free
trial copy today!


      The World's Number 1 Web Host

© Copyright 2008 TheScarms