comparison flys-backend/src/main/java/de/intevation/flys/utils/DateGuesser.java @ 4770:28fa48986ae9

DateGuesser: Take current year modulo 100 if compare it with a two digit year value. Removed auto boxing.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 04 Jan 2013 15:55:45 +0100
parents 1cfda99c024c
children
comparison
equal deleted inserted replaced
4769:92a08725bc63 4770:28fa48986ae9
214 214
215 if (m.matches()) { 215 if (m.matches()) {
216 Calendar cal = Calendar.getInstance(); 216 Calendar cal = Calendar.getInstance();
217 String day = m.group(1); 217 String day = m.group(1);
218 String month = m.group(2); 218 String month = m.group(2);
219 String yearS = m.group(3); 219 String yearS = m.group(3);
220 Integer year = Integer.parseInt(yearS); 220 int year = Integer.parseInt(yearS);
221 if (year <= Calendar.getInstance().get(Calendar.YEAR)) { 221
222 if (year <= cal.get(Calendar.YEAR) % 100) {
222 year += 2000; 223 year += 2000;
223 } 224 }
224 else { 225 else {
225 year += 1900; 226 year += 1900;
226 } 227 }

http://dive4elements.wald.intevation.org