Hi guys, good day, just want to ask if there's a function that determines the number of days in a month, In a Roman Calendar, the days in a month are either 30 or 31, but if it's a leap year(every 4 years) the month of February is 29 instead of 28...

my another problem is this:
I'm making an [issue date] of books and [deposit date] of books...
the issue date will get the current [month,day, and year] of the system time. The Deposit date will add 5 days from the current month,day and year...

For Example:

Today is: 10/15/2009(October 15, 2009)
Now when the the TextBox, lets say its name is 'txtIssueDate' its value is the current month,day and year, when the TextBox lost the focus and the focus go to another textbox, let's say its name is 'txtDepositDate', when this textbox got the focus, the date value in txtIssueDate will automaticaly increase by five,


IssueDate: 10/15/2009
DepositDate: 10/20/2009

but when the month changes...
(Months number of days are either 30 or 31)

IssueDate: 10/31/2009
DepositDate: 11/05/2009-month increases


Now when the year ends..

IssueDate: 12/31/2009
DepositDate: 01/05/2010-the year increases

Don't forget the leap year....when it's a leap year the number of days of the month 'February' is 29 instead of 28....


Thanks in advance... :)

Look at the dateadd function....

Dim LastDayOfMonth As Integer
LastDayOfMonth = Day(DateAdd("d", -1, Month(Now) + 1 & "/1/" & Year(Now)))

Good Luck

commented: Thank you for your time and effort for solving my problem! :) +1

The DateAdd function will work without having to worry about how many days are in the current month.

txtDepositDate.text=DateAdd("d",5,Now())
commented: Thank you for your time and effort for solving my problem! :) +1

But that was not what the OP was asking there elkhartlynn...

Thanks! Thanks!,,...thanks to the two of you, for your time and effort for doing this....

these posts really helped me...,and maybe I'll just do some research regarding these... Date function....Thank you again!
PROBLEM SOLVED!!!.... :D

The example identified dealt with the concern for calculating what date is 5 days from a date and whether the change in month or year was occurring. I wanted the OP to know that it didn't make any difference as the DateAdd routine takes all of that into consideration.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.