nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Bug?? SimpleDateFormat Java 1.5

Von: Oliver Nass (oliver.nass@gmx.de) [Profil]
Datum: 13.10.2009 15:32
Message-ID: <c1c29065-633d-49d9-bc71-9b9e0bfc341f@j19g2000yqk.googlegroups.com>
Newsgroup: de.comp.lang.java
Hallo,

ich habe hier eine eigenartige Meldung, handelt es sich hierbei um ein
Bug?

SimpleDateFormat formatJah1 = new SimpleDateFormat
("dd.MM.yy");
Date dat = new Date();
try {
dat = formatJah1.parse("28.12.2008");
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat formatJah = new SimpleDateFormat("wwyy");
String datum = formatJah.format(dat);

Eingelesen wird ein Datum, ausgespuckt die Woche mit Jahr.
Gebe ich 28.12.2008 ein, kommt 5208 heraus (richtig), gebe ich
29.12.2008 ein, dann 0108.
Das ganze geht auch bei dem Jahreswechsel 09/10, der 01.01.2010 ist
5310.

Übersehe ich was?

Gruss Oliver

[ Auf dieses Posting antworten ]

Antworten