FileDocCategorySizeDatePackage
DateDiff.javaAPI DocExample546Fri Apr 20 21:16:32 BST 2001None

DateDiff

public class DateDiff extends Object
DateDiff -- compute the difference between two dates.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)

		/** The ending date. This value
		 * doubles as a Y2K countdown time.
		 */
		Date d1 = new GregorianCalendar(1999,11,31,23,59).getTime();

		/** Today's date */
		Date d2 = new Date();

		// Get msec from each, and subtract.
		long diff = d2.getTime() - d1.getTime();

		System.out.println("Difference between " + d2 + "\n" +
			"\tand Y2K is " +
			(diff / (1000*60*60*24)) +
			" days.");