Last date of month

Advertisement
Hi im new to java. Looking for a class that provides last date of the month according to a given year and month .
Advertisement

Replay

java does provide a calendar object for gregorian
dates.. surprising its called GregorianCalendar. :PAs I said avoid GregorianDate in Java it is a poor implementation. Date arithmetic is overly complex. There are inconsistencies i.e. Month starts at zero Jan is 0 day of week starts at 1 (Sunday = 1, Monday = 2) First of the month is 0 not 1 as one would expect. Sun's date does not handle dates prior to 1970 ( a real pain in your are doing historical data analysis). Suns Date uses 2 digit years.
BigDate makes date arithmetic a slam dunk.
To find the second monday in June 1961
BigDate aDate = new BigDate(BigDate.nthXXXDay( 2, 1, 1961, 6));
yyyy = aDate.getYYYY();
mm = aDate.getMM ();
dd = aDate.getDD ();
To calculate 156 days after the 1st of Jan 1999. You would do the following.
BigDate aDate = new BigDate (1999, 1 , 1 + 156, BigDate.NORMALIZE);
yyyy = aDate.getYYYY();
mm = aDate.getMM ();
dd = aDate.getDD ();
or
BigDate aDate = new BigDate (1999, 1 , 1 );
aDate.setOrdinal(aDate.getOrdinal( )+ 156);
yyyy = aDate.getYYYY();
mm = aDate.getMM ();
dd = aDate.getDD ();