BigDate converts back and forth between Julian (days since 1970
Jan 01) and Gregorian (yyyy mm dd) forms. BigDate handles dates from 999,999 BC
to 999,999 AD. It handles the following calendar anomalies:
missing year 0.
missing 10 days in 1582 from Oct 05 to Oct 14.
the change in leap year rule calculation in 1600.
leaps every 4 years, except every 100, except every 400.
BigDate differs from Sun's Date in that it handles dates prior
to 1970, and it uses Julian day numbers relative to 1970 Jan 01 rather than millisecond
timestamps. BigDate uses 4, 5 or 6 digit years rather than 2-digit years like
Sun's Date. Month 01=January as is traditional, unlike Sun's Date which uses 00=Jan.
Similarly, the first of the month is 01 not 00 as in Sun's Date class. For example
here is how you could compute the day after a given date:
BigDate g = new BigDate (yyyy, mm , dd + 1, BigDate.NORMALIZE);
yyyy = g.getYYYY ();
mm = g.getMM ();
dd = g.getDD ();
This second way is more verbose, but it does a check that yyyy, mm, dd are valid
and executes slightly faster.
BigDate g = new BigDate ( yyyy, mm, dd);
g.setOrdinal(g.getOrdinal( )+1);
yyyy = g.getYYYY ();
mm = g.getMM ();
dd = g.getDD ();
There are many more examples in the TestDate.java class that comes with BigDate
. BigDate is a bit of a misnomer, BigDate objects are smaller and faster than
java.util.Date or java.util.GregorianCalendar objects. I called them BigDate s
because they can accurately handle a wider range of date than the Java classes.