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

last day of month 2

Status
Not open for further replies.

obuspider

Programmer
Oct 31, 2002
78
0
0
US
Is There a way to easily determine the last day of the month?
 
Try this function:

Function LastdayInMonth(byVal datDate)
'move to the next month
datDate = dateadd("m",1,datDate)
'move back one day from first day in this month
datDate = dateadd("d",-1,month(datDate) & "/1/" & year(datDate))
'return date as last day in this month
LastdayInMonth= datDate
End Function

 
yes
if a variable mydate contains the month
1 is for january, 2 for february and so on
do this

reqdate = cDate((mydate+1) & "/1/" & year(now))
reqdate = cDate(reqdate -1)

this will give you the last date

You can of course put it in a function too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top