I have noticed some calendar anomalies.
If I run the following code:
import java.util.GregorianCalendar;
import java.util.Date;
import java.util.Calendar;
public class TimeTest {
public static void main (String[] args) {
GregorianCalendar cal = new GregorianCalendar();
Calendar cal2 = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
System.out.println ("Month = " + cal.get(cal.MONTH) + ", " + cal2.get(cal2.MONTH));
System.out.println ("Hour = " + cal.get(cal.HOUR) + ", HOUR_OF_DAY = " + cal.get(cal.HOUR_OF_DAY));
}
}
I get an output of 2 for the month, and one hour later than the current time for the hour. Does anyone know what could be causing this?
Many thanks,
-Stile