FileDocCategorySizeDatePackage
DateDiff.javaAPI DocExample515Tue Nov 25 08:23:00 GMT 2003None

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 date at the end of the last century */
		Date d1 = new GregorianCalendar(2000,11,31,23,59).getTime();

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

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

		System.out.println("The 21st century (up to " + today + 
			") is " + (diff / (1000*60*60*24)) + " days old.");