Name: nt126004 Date: 06/12/2003
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
on the 12 hour clock the hour after midnight is 12am, but Calendar.get(Calendar.HOUR) returns 0, not 12 for a time set in that hour.
It seems that this should be the behavior for HOUR_OF_DAY, but HOUR should
return 12.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile and run below code
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class BadDate {
public static void main(String[] args) {
Calendar am = Calendar.getInstance(), pm = Calendar.getInstance(
);
am.set(2003, 04, 22, 0, 15, 5); // midnight hour
pm.set(2003, 04, 22, 12, 15, 5); // noon hour
System.out.println(am.get(Calendar.HOUR));
System.out.println(am.get(Calendar.HOUR_OF_DAY));
System.out.println(pm.get(Calendar.HOUR));
System.out.println(pm.get(Calendar.HOUR_OF_DAY));
}
}
---------- END SOURCE ----------
(Review ID: 186444)
======================================================================