mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-07 18:48:39 +00:00
Change Calendar.getInstance to new GregorianCalendar
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1099402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5f9fd135a2
commit
3149ea2511
@ -26,6 +26,7 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
@ -690,13 +691,13 @@ public String format(long millis) {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Formats a {@code Date} object.</p>
|
||||
* <p>Formats a {@code Date} object using a {@code GregorianCalendar}.</p>
|
||||
*
|
||||
* @param date the date to format
|
||||
* @return the formatted string
|
||||
*/
|
||||
public String format(Date date) {
|
||||
Calendar c = Calendar.getInstance(mTimeZone, mLocale);
|
||||
Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar
|
||||
c.setTime(date);
|
||||
return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString();
|
||||
}
|
||||
@ -726,14 +727,14 @@ public StringBuffer format(long millis, StringBuffer buf) {
|
||||
|
||||
/**
|
||||
* <p>Formats a {@code Date} object into the
|
||||
* supplied {@code StringBuffer}.</p>
|
||||
* supplied {@code StringBuffer} using a {@code GregorianCalendar}.</p>
|
||||
*
|
||||
* @param date the date to format
|
||||
* @param buf the buffer to format into
|
||||
* @return the specified string buffer
|
||||
*/
|
||||
public StringBuffer format(Date date, StringBuffer buf) {
|
||||
Calendar c = Calendar.getInstance(mTimeZone, mLocale);
|
||||
Calendar c = new GregorianCalendar(mTimeZone, mLocale); // hard code GregorianCalendar
|
||||
c.setTime(date);
|
||||
return applyRules(c, buf);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user