Introduction
This tutorial is designed to provide you with an understanding of the Java Calendar class, it’s backgrounds, purpose and uses. It is created in such a manner as to allow even beginning Java programmers an understanding and feel for the uses of the Java Calendar class. The Java Calendar class was added to the Java Development Kit in JDK 1.1. It is designed to permit the conversion between a specific instance in time and a set of Calendar fields. (Oracle, 2004, 2010) What exactly does this mean? The Calendar class uses a huge array of tables to keep track of time based on daylight savings time, timezones, and calendar history, the calendar class uses a system time to determine where whatever event is being tracked falls on in the internal calendar tables. Some confusion is caused by this as Java does keep track of specific location time, and the programmer needs to keep this in mind when using the Calendar class even when it isn’t relevant to the problem being addressed (Roedy Green, Canadian Mind Products, 1196-2011).
How to use the Calendar Class The Calendar Class and it’s associated methods are used by three methods. The programmer can import the calendar class and whatever specific method or constructor they will use in their program by importing it as importjava.util.specificfunction; For instance, if the programmer wished to set the date within a program, but that was all that was needed, for instance no date specific math was needed as in a log file, then the programmer could use, importjava.util.Calendar.set; If the programmer needs to have greater functionality associated with the dates being used within a program the programmer should use the entire Calendar class. This takes up more space within a program, however provides a much simpler method of calling items from the Java Calendar class as all of it’s functionality is available to the entire program. This format would simply be,
importjava.util.Calendar;
References: 1. Oracle. (2004, 2010). java.util Class Calendar. Retrieved from http://download.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html#set(int, int) 2. Roedy Green, Canadian Mind Products. (1196-2011). Calendar : Java Glossary. Retrieved from http://mindprod.com/jgloss/calendar.html