Fix up the zeroTime() function. Calendar has two unique fields that store
hour data for some reason, which are both set when one does Calendar.getInstance(), so we need to change both of them if we actually want the hour to change. Also change to explicitly set the fields to zero, since clear isn't setting them to zero but to 'undefined' which happens to be interpreted as zero. Might as well be explicit about what we want. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1476 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -15,10 +15,11 @@ public class CalendarUtil
|
||||
*/
|
||||
public static void zeroTime (Calendar cal)
|
||||
{
|
||||
cal.clear(Calendar.HOUR);
|
||||
cal.clear(Calendar.MINUTE);
|
||||
cal.clear(Calendar.SECOND);
|
||||
cal.clear(Calendar.MILLISECOND);
|
||||
cal.set(Calendar.HOUR, 0);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user