Calendar and Time Zone Support

Since version 1.1 of the JDK, the Date class has been used as just a wrapper around a date or time instance. It can represent dates or times with millisecond precision. However, you need more when it comes to working with internationalized dates or times. For this, you need to use the java.util.Calendar class and its subclass java.util.GregorianCalendar. You also can make use of the java.util.TimeZone class to represent time zone offsets and to help in calculating daylight savings. Together, these classes provide a rich library to aid in date and time calculations. The following sections look at each one briefly.

Calendar Class

The java.util.Calendar class is an abstract class that provides culture-independent methods ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.