Date expressions - help appreciated!!!

A

ac512

Hello

I am just wondering if there is an easy way that an expression can be used
to calculate the number of days in a month?

Any assistance would be greatly appreciated

Thank you in advance

AC
 
T

tina

well, the number of days in a month can change - specifically, the number of
days in February, depending on what year it is. for the number of days in a
*specific month of a specific year*, the following will work, as

Public Function isDaysCount(ByVal dat As Date) As Integer

Dim dat2 As Date

dat2 = DateAdd("m", 1, dat)

isDaysCount = DateDiff("d", DateSerial(Year(dat), Month(dat), 1), _
DateSerial(Year(dat2), Month(dat2), 1))

End Function

the function requires a complete date (month, day, year) for its' argument.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top