Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question about dates

Status
Not open for further replies.

phunugus

Programmer
Dec 26, 2002
21
US
Im writing this daily/weekly/monthy reminder program, but im stuck on how to implement monthly reminders. I store the first day that the reminder will run. So how would i do this? my only idea has been:

if today's date is a multiple of 30, but this is flawed for many reasons...

im not that good at math, so any suggestions? (besides a math course)

thanx for any replies
 
I've not tested this, and there may be a more elegant way of doing it, but

Public Function blnRemind(ByRef datOriginal As Date) As Boolean
'if the day of the month now is the same as it was then, then return true
If datOriginal.Day = Now.Day Then Return True
'otherwise, we still have to return true if there are less days in the month now than then, and today is the last day of the month
If Date.DaysInMonth(Now.Year, Now.Month) < Date.DaysInMonth(datOriginal.Year, datOriginal.Month) AndAlso _
Now.Day = Date.DaysInMonth(Now.Year, Now.Month) Then Return True
End Function Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top