mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-19 02:19:01 +08:00
SimpleDateFormat.java (format): Zero pad unless field size is 2.
2003-07-24 H. V�is�nen <hvaisane@joyx.joensuu.fi> * java/text/SimpleDateFormat.java (format) [YEAR_FIELD]: Zero pad unless field size is 2. From-SVN: r69744
This commit is contained in:
parent
270606acd8
commit
bb477ffa48
@ -1,3 +1,8 @@
|
||||
2003-07-24 H. Väisänen <hvaisane@joyx.joensuu.fi>
|
||||
|
||||
* java/text/SimpleDateFormat.java (format) [YEAR_FIELD]: Zero pad
|
||||
unless field size is 2.
|
||||
|
||||
2003-07-23 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||
|
||||
* gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
|
||||
|
@ -430,11 +430,15 @@ public class SimpleDateFormat extends DateFormat
|
||||
buffer.append(formatData.eras[calendar.get(Calendar.ERA)]);
|
||||
break;
|
||||
case YEAR_FIELD:
|
||||
temp = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
if (p.size < 4)
|
||||
buffer.append(temp.substring(temp.length()-2));
|
||||
// If we have two digits, then we truncate. Otherwise, we
|
||||
// use the size of the pattern, and zero pad.
|
||||
if (p.size == 2)
|
||||
{
|
||||
temp = String.valueOf(calendar.get(Calendar.YEAR));
|
||||
buffer.append(temp.substring(temp.length() - 2));
|
||||
}
|
||||
else
|
||||
buffer.append(temp);
|
||||
withLeadingZeros(calendar.get(Calendar.YEAR), p.size, buffer);
|
||||
break;
|
||||
case MONTH_FIELD:
|
||||
if (p.size < 3)
|
||||
|
Loading…
Reference in New Issue
Block a user