FileDocCategorySizeDatePackage
DateCalAdd.javaAPI DocExample583Sat Mar 03 20:39:30 GMT 2001None

DateCalAdd

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

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

		/** Today's date */
		Calendar now = Calendar.getInstance();

		/* Do "DateFormat" using "simple" format. */
		SimpleDateFormat formatter
			= new SimpleDateFormat ("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
		System.out.println("It is now " + 
			formatter.format(now.getTime()));

		now.add(Calendar.DAY_OF_YEAR, - (365 * 2));
		System.out.println("Two years ago was " + 
			formatter.format(now.getTime()));