Determining Next Occurance of a Date

Pizzor2000
08-25-2009, 08:15 AM
I am working with two dates: an annually recurring due date and the date a payment was made for a specific year. The two given dates may not be from the same year. What I want to do is figure out the date this particular payment was due by determining the first occurance of the given due date to come after the payment date.

Examples:
DueDate: 8/15/1991, Payment: 7/20/2005, Desired Result: 8/15/2005
DueDate: 7/1/2004, Payment: 6/22/1995, Desired Result: 7/1/1995
DueDate: 1/5/2001, Payment: 12/15/2007, Desired Result: 1/5/2008

Any thoughts on how I could do this through VB?

kassyopeia
08-25-2009, 09:26 AM
You can use Day (http://msdn.microsoft.com/en-us/library/aa262722(VS.60).aspx) and Month (http://msdn.microsoft.com/en-us/library/aa445079(VS.60).aspx) to get the due date and Year (http://msdn.microsoft.com/en-us/library/aa263407(VS.60).aspx) to get the payment year, and then put them back together using DateSerial (http://msdn.microsoft.com/en-us/library/aa262716(VS.60).aspx). Then, you just need to compare that date with the payment date and add an extra year if necessary.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum