The Date class
This class provides an implementation of "date" structures. Date has methods to create and compare dates, obtain and set the time, and convert dates to strings.
The Date constructor creates today's date:
In Java 1.1, most Date methods have been deprecated in favor of the Calendar class:
- Calendar date1 = Calendar.getInstance();
- date1.set( 999, 12, 31 ); /* Dec. 31, 999 */
- Calendar date2 = Calendar.getInstance();
- date2.set( 1996, 12, 31, 23, 59, 59 )
- /* Dec.31,1996 at 23:59:59 */