File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
sql-jdbc/src/main/java/org/opensearch/jdbc/types Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 8
8
9
9
import java .sql .SQLException ;
10
10
import java .sql .Timestamp ;
11
+ import java .time .LocalDate ;
11
12
import java .time .LocalDateTime ;
12
13
import java .util .Calendar ;
13
14
import java .util .Map ;
@@ -78,13 +79,17 @@ else if (value.charAt(23) == '+' || value.charAt(23) == '-') {
78
79
}
79
80
}
80
81
81
- if (calendar == null ) {
82
- return Timestamp .valueOf (value );
82
+ final Timestamp ts ;
83
+ if (value .length () < 11 ) {
84
+ ts = Timestamp .valueOf (LocalDate .parse (value ).atStartOfDay ());
83
85
} else {
84
- Timestamp ts = Timestamp .valueOf (value );
85
- return localDateTimeToTimestamp (ts .toLocalDateTime (), calendar );
86
+ ts = Timestamp .valueOf (value );
86
87
}
87
88
89
+ if (calendar == null ) {
90
+ return ts ;
91
+ }
92
+ return localDateTimeToTimestamp (ts .toLocalDateTime (), calendar );
88
93
} catch (IllegalArgumentException iae ) {
89
94
throw stringConversionException (value , iae );
90
95
}
You can’t perform that action at this time.
0 commit comments