|
|
@@ -127,6 +127,8 @@ public class Converters {
|
|
|
// 经测试 JDBC 不会返回 java.util.Date 类型。java.sql.Date, java.sql.Time,java.sql.Timestamp 全部直接继承自 java.util.Date, 所以 getDate可以返回这三类数据
|
|
|
@Override
|
|
|
public java.util.Date convert(String s) throws ParseException {
|
|
|
+ s = supportHtml5DateTimePattern(s);
|
|
|
+
|
|
|
if (timeStampWithoutSecPatternLen == s.length()) {
|
|
|
s = s + ":00";
|
|
|
}
|
|
|
@@ -146,6 +148,8 @@ public class Converters {
|
|
|
// mysql type: date, year
|
|
|
@Override
|
|
|
public java.sql.Date convert(String s) throws ParseException {
|
|
|
+ s = supportHtml5DateTimePattern(s);
|
|
|
+
|
|
|
if (timeStampWithoutSecPatternLen == s.length()) {
|
|
|
s = s + ":00";
|
|
|
}
|
|
|
@@ -179,10 +183,7 @@ public class Converters {
|
|
|
// mysql type: timestamp, datetime
|
|
|
@Override
|
|
|
public java.sql.Timestamp convert(String s) throws ParseException {
|
|
|
- // 支持 html5 的 datetime 组件,格式为:2019-01-23T11:22
|
|
|
- if(s.indexOf(' ') == -1 && s.indexOf('T') != -1 && s.indexOf('-') != -1 && s.indexOf(':') != -1) {
|
|
|
- s = s.replace("T", " ");
|
|
|
- }
|
|
|
+ s = supportHtml5DateTimePattern(s);
|
|
|
|
|
|
if (timeStampWithoutSecPatternLen == s.length()) {
|
|
|
s = s + ":00";
|
|
|
@@ -195,4 +196,13 @@ public class Converters {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 支持 html5 的 datetime 组件,格式为:2019-01-23T11:22
|
|
|
+ public static String supportHtml5DateTimePattern(String s) {
|
|
|
+ if (s.indexOf(' ') == -1 && s.indexOf('T') != -1 && s.indexOf('-') != -1 && s.indexOf(':') != -1) {
|
|
|
+ return s.replace("T", " ");
|
|
|
+ } else {
|
|
|
+ return s;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|