What Is java Date
In JDK 1.0 (1996) java introduce the date class for represent the Date and time.
The date object stores an integer representation of the number of milliseconds relative to midnight midnight of January 01 1970. in the other word instantiate the class using default constructor and then call the time method in a print statement the terminal will print from milliseconds passed since midnight of January 1st 1970.
import java.util.date ;
class Main
{
public static void main (String[] args)
{
Date d = new Date();
}
}
the out put is = give the value of millisecond between midnight of January 1970 and current date and time.
In JDK 1.1 (1997) introduce a calendar class because of apart from the issue with internationalization and accuracy there were some inconsistencies that made the class not very intuitive to use.
What is java.util.date
The java.util.Date class represents date and time in java. It provides constructors and methods to deal with date and time in java.
The java.util.Date class implements Serializable, Cloneable and Comparable<Date> interface. It is inherited by java.sql.Date, java.sql.Time and java.sql.Timestamp interfaces.
Get Anuruddha Srimal’s stories in your inbox
Join Medium for free to get updates from this writer.
After Calendar class, most of the constructors and methods of java.util.Date class has been deprecated. Here, we are not giving list of any deprecated constructor and method.
java.util.Date Constructors
java.util.Date Methods
What is java.sql.date
The java.sql.Date class represents the only date in Java it does not represent the time like java.util.Date class. It inherits the java.util.Date class. The java.sql.Date instance is widely used in the JDBC because it represents the date that can be stored in a database.
Other important thing is java.sql.date extend the java.util.date class.
Some constructors and methods of java.sql.Date class has been deprecated.
java.sql.Date Constructor
java.sql.Date Methods
What is epoch type?
In a computing context, an epoch is the date and time relative to which a computer’s clock and timestamp values are determined. The epoch traditionally corresponds to 0 hours, 0 minutes, and 0 seconds (00:00:00) Coordinated Universal Time (UTC) on a specific date, which varies from system to system. Most versions of Unix, for example, use January 1, 1970 as the epoch date; Windows uses January 1, 1601; Macintosh systems use January 1, 1904, and Digital Equipment Corporation’s Virtual Memory System (VMS) uses November 17, 1858.
The date and time in a computer is determined according to the number of seconds or clock ticks that have elapsed since the defined epoch for that computer or platform. This number is limited by the word length, and also by the number of clock ticks per second. In a 32-bit computer with 1 tick per second, for example, the clock will wrap around (that is, reach its maximum numerical time) on January 18, 2038. This is not likely to be a problem, because most computers are obsolete after a few years, and longer word lengths and/or new epochs will likely be defined before 2038. However, in a computer with 16 ticks per second, wrap-around can occur well within the useful lifetime of the machine.
Other ways “epoch” is used: In geology, an epoch is a period of time of variable length that is a portion of a period, which in turn is a fractional part of an era. We are currently in the Holocene epoch, which is part of the Quaternary period, which in turn is part of the Cenozoic era. In prediction of tides, an epoch is a period of 19 years, representing one complete cycle of all possible alignments of the sun and the moon. In astronomy, an epoch is the point in time where a calendar, or a defined time frame within a calendar, is considered to begin. In 1984, the International Astronomical Union decided that epoch 2000.0 would begin at 1200 UTC on January 1, 2000.









