flipped from being hardcoded to GregorianCalendar to using getInstance. Cannot think of any reason why a GregorianCalendar was being created directly

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2004-06-27 06:29:29 +00:00
parent 680f38995b
commit 5f7e26a978
1 changed files with 4 additions and 5 deletions

View File

@ -17,7 +17,6 @@
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.TimeZone;
@ -32,7 +31,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Phil Steitz
* @since 2.0
* @version $Id: DateUtils.java,v 1.18 2004/02/18 22:56:42 ggregory Exp $
* @version $Id: DateUtils.java,v 1.19 2004/06/27 06:29:29 bayard Exp $
*/
public class DateUtils {
@ -134,7 +133,7 @@ public static Date round(Date date, int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
GregorianCalendar gval = new GregorianCalendar();
Calendar gval = Calendar.getInstance();
gval.setTime(date);
modify(gval, field, true);
return gval.getTime();
@ -214,7 +213,7 @@ public static Date truncate(Date date, int field) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
GregorianCalendar gval = new GregorianCalendar();
Calendar gval = Calendar.getInstance();
gval.setTime(date);
modify(gval, field, false);
return gval.getTime();
@ -502,7 +501,7 @@ public static Iterator iterator(Date focus, int rangeStyle) {
if (focus == null) {
throw new IllegalArgumentException("The date must not be null");
}
GregorianCalendar gval = new GregorianCalendar();
Calendar gval = Calendar.getInstance();
gval.setTime(focus);
return iterator(gval, rangeStyle);
}