I'm trying to access a DB field which represents a datetimetz
ABL type. I tried ResultSet.getTimestamp(int)
which should be correct , though the driver complains with [DataDirect][OpenEdge JDBC Driver]Value can not be converted to requested type.
.
I've tried all date and time getters on ResultSet
which none work. A call to ResultSet.getObject(int)
returns a String
representing the value, however this value is a non-standard format which actually has a quirk making it difficult to parse with a SimpleDateFormat
, this format comes out looking like "2013-03-08 21:55:10:903 + 11:00
".
From this quirky date it can't be parsed cleanly with a format string due to the space after the +/-
in the time-zone qualifier and I've had to resort to the following ugly method:
String r = rs.getString(col);
if (r == null) {
return null;
}
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSSXXX",
Locale.getDefault());
try {
return df.parse(r.substring(0, 23)
+ r.substring(24, 25)
+ r.substring(26));
} catch (ParseException ex) {
return null;
}
I am using OpenEdge 10.1.C04