Calcualte Relative Date from Today (Leap Year Aware)

Category:
Dates and Math
Type:
Snippets
Difficulty:
Beginning
Author:
Brent Coppock

Version Compatibility: Visual Basic 6

More information:
This function is to be used when you want to calculate a date relative to the current date and you need the function to be aware of the leap year. Example: If you are calculating someones birthday for next year and next year is a leap year, unless their birthday occurs before Feb,29, the standard DateAdd function in Visual Basic will be one day off. If you use this function, it will return the correct date, relative to this one. If you find a bug with this code, please by all means send me an email at mylists@shaw.ca

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: