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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Days of the month 2

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
0
0
US
I can't seem to put my finger on this one.

What is the function/code to tell how many days are in a month based on a date?

Example

Function DaysOfTheMonth(July 15, 2003) = 31 days.

ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Hi,

This should do it for you:
Dim datDate As Date
datDate = "July 15, 2003"
MsgBox Day(DateAdd("m", 1, datDate - Day(datDate) + 1) - 1)

Bill
 
Just for the sake of variety you can look at this one also

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

It is very much like the excellent one Bill posted.

Paul
 
Thanks guys. I actually went with the dateserial. I put them both in my cool code file. Thanks again.

ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top