Link to home
Get AccessLog in
Avatar of slickdeals
slickdeals

asked on

Finding the correct date instance?

Hi,

Is possible to write a function which inputs the month and year and returns the last Date(java.util.Date instance) of that month.

I really cannot hash this out how to pursue this.

Thanx in advance.



ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of slickdeals
slickdeals

ASKER

cau explain me the code a bit please. That will be a big help?
last day of the month is the day before the 1st day of the next month

cal.set(year, month, 1);       // 1st day of next month (0 = jan)
cal.add(Calendar.DATE, -1);  // go back one day