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!

how to get Last day of the month dd/mm/yy

Status
Not open for further replies.

klasse

Programmer
Jan 12, 2004
32
0
0
SE
Hi,

Is there any function with which I could get the last day of the month in the format 31/01/02 (for this month for example)?

Or at least, a function to get the number of days of this month ?

Thanks,

Klasse
 
? Dateserial(Year(Date), MOnth(Date) + 1, 0)
1/31/02
? Day(Dateserial(Year(Date), MOnth(Date) + 1, 0))
31

? Format(Dateserial(Year(Date), MOnth(Date) + 1, 0), "dd/mm/yy")
31/01/02

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Hi Klasse!

Try this:

Format(DateAdd("d", -1, DateSerial(Year(Date(), Month(Date() + 1), 1), "dd/mm/yy")

To get the number of days in the month use this:

DateDiff("d", Date(), DateAdd("m", 1, Date()))

hth
Jeff Bridgham
bridgham@purdue.edu
 
Many thanks to the two of you, I will try both solutions.

Klasse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top