[Dive4elements-commits] [PATCH] backend: Fixed DateGuesser for DDMMYY
Wald Commits
scm-commit at wald.intevation.org
Fri May 3 12:51:57 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1367578289 -7200
# Node ID 4110565baff8a3a33f176a80f9fd04ed2367ce51
# Parent 62e6598a2c4b5108907aa76f70dab8e761b72ac4
backend: Fixed DateGuesser for DDMMYY.
diff -r 62e6598a2c4b -r 4110565baff8 backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java
--- a/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java Fri May 03 10:31:34 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/utils/DateGuesser.java Fri May 03 12:51:29 2013 +0200
@@ -54,7 +54,7 @@
Pattern.compile("^(\\d{1,2})\\.(\\d{1,2})\\.(\\d{2,4})T(\\d{1,2}):(\\d{2}):(\\d{2})$");
public static final Pattern DDMMYY =
- Pattern.compile("^(\\d{1,2})(\\d{1,2})(\\d{1,2})$");
+ Pattern.compile("^(\\d{2})(\\d{2})(\\d{2})$");
private DateGuesser() {
}
@@ -87,7 +87,7 @@
String year = m.group(1);
String month = m.group(2);
String day = m.group(3);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year),
calendarMonth(month),
@@ -103,11 +103,11 @@
String year = m.group(3);
String month = m.group(2);
String day = m.group(1);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
calendarMonth(month),
- Integer.parseInt(m.group(1)),
+ Integer.parseInt(day),
12, 0, 0);
return cal.getTime();
}
@@ -120,7 +120,7 @@
Calendar cal = Calendar.getInstance();
String year = m.group(3);
String day = m.group(1);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
month,
@@ -139,7 +139,7 @@
String day = m.group(3);
String hour = m.group(4);
String minute = m.group(5);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year),
calendarMonth(month),
@@ -161,7 +161,7 @@
String hour = m.group(4);
String minute = m.group(5);
String second = m.group(6);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year),
calendarMonth(month),
@@ -182,7 +182,7 @@
String day = m.group(1);
String hour = m.group(4);
String minute = m.group(5);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
calendarMonth(month),
@@ -204,7 +204,7 @@
String hour = m.group(4);
String minute = m.group(5);
String second = m.group(6);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
calendarMonth(month),
@@ -231,7 +231,7 @@
else {
year += 1900;
}
- cal.clear();
+ cal.clear();
cal.set(
year,
Integer.parseInt(month), // month
@@ -245,7 +245,7 @@
if (m.matches()) {
Calendar cal = Calendar.getInstance();
String year = m.group(1);
- cal.clear();
+ cal.clear();
cal.set(
Integer.parseInt(year) + (year.length() == 2 ? 1900 : 0),
5, // month
More information about the Dive4elements-commits
mailing list