number of days in month

O

OD

I know I can create a table and check to see if it is a leep year. The
question is thier a function to get the number of days in a given (month,
year).

Example:

varDate = 8/1/2009

PS I'm using DatePart("w",varDate) to get the day of the week, but I need to
know how many day in each month.

"I'm building an sceduling calendar"

Thanks

O.D.
 
J

John W. Vinson

I know I can create a table and check to see if it is a leep year. The
question is thier a function to get the number of days in a given (month,
year).

Example:

varDate = 8/1/2009

PS I'm using DatePart("w",varDate) to get the day of the week, but I need to
know how many day in each month.

"I'm building an sceduling calendar"

Thanks

O.D.

Day(DateSerial(Year([datefield]), Month([datefield]) + 1, 0))

The dateserial function will get the zeroth day of the NEXT month - which is
the last day of the selected month; the Day() function will get the day number
of that date (28, 29, 30 or 31 as appropriate).

And you don't need a table:

IsDate("02/29/" & Year([datefield]))

will be TRUE if the datefield is during a leap year, False otherwise.
 

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