The Date class encapsulates the current date and time. Before beginning our examination of Date, it is important to point out that it has changed substantially from its original version defined by [ava 1.0. When Java 1.1 was released, many of the functions carried out by the original Dale class were moved into the Calendar and Date Format classes, and as a result, many of the original 1.0 Date methods were deprecated. Java 2 adds a few new methods to the time and date classes, but otherwise implements them in the same form as did 1.1. Since the deprecated 1,0 methods shall ld not be used for new code, they arc not described here. Date supports the following constructors: Date( ) Date(long millisec) The first constructor initializes the object with the current date and time. The second constructor accepts one argument that equals the number of milliseconds that have elapsed since midnight, January I, 1970. The Non Deprecated methods defined. With the advent of Java 2, Date also implements the Comparable interface.

[vfb id=1]

Share This