#686 - Trouble with non-standard java.sql.Date values caching in 7.8.1.

This commit is contained in:
Robin Bygrave committed 2016-04-29 22:22:38 +12:00
1 parent 5bcfce9cd4
commit 9da5ce01a7
3 files changed
+38 -3

No files matched your search

@@ -52,12 +52,19 @@ public abstract class ScalarTypeBaseDate<T> extends ScalarTypeBase<T> {
public String formatValue(T t) {
Date date = convertToDate(t);
return date.toString();
// format all dates into epoch millis
long epochMillis = date.getTime();
return Long.toString(epochMillis);
}
public T parse(String value) {
Date date = Date.valueOf(value);
return convertFromDate(date);
try {
long epochMillis = Long.parseLong(value);
return convertFromDate(new Date(epochMillis));
} catch (NumberFormatException e) {
Date date = Date.valueOf(value);
return convertFromDate(date);
}
}
public T convertFromMillis(long systemTimeMillis) {