There is a database procedure (to which I do not have access to, so I can't view its source or edit it) in a Sybase database that I query for information about events, and those events have a start and end date.
EDIT: This effect also happens when I queried a freshly-created table of just dates, created as such:
create table jvo_test.test_dates(dt datetime not null primary key)
insert into jvo_test.test_dates(dt) select dateadd(mi, (id-1) *30, '2019-03-06 00:00:00') from rle.row_generator where id between 1 and 48
END EDIT
The trouble is that when these events take place an hour after midnight (so in the 00:00 - 01:00 range) the resulting timestamp jumps back in past an hour???
Example: right now the procedure returns two events, one on 23:44 and the other for 00:07
Code:
Connection c = ds.getConnection();
String sql = "procedure_name 'param1', 'param2', 'param3'";
PreparedStatement ps = c.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
while (rs.next()) {
for(int i = 1; i < rsmd.getColumnCount(); i++) {
log.debug("{} is of type: {}", rsmd.getColumnName(i), rsmd.getColumnType(i));
}
log.debug("AS STRING start_time: {}, end_time: {}",
rs.getString("start_time"),rs.getString("end_time"));
log.debug("AS TIMESTAMP start_time: {}, end_time: {}",
rs.getTimestamp("start_time"),rs.getTimestamp("end_time"));
}
This results in the following log lines
start_time is of type: 93
end_time is of type: 93
AS STRING start_time: 2019-02-19 23:44:23.000000, end_time: 2019-02-19 23:44:29.000000
AS TIMESTAMP start_time: 2019-02-19 23:44:23.0, end_time: 2019-02-19 23:44:29.0
start_time is of type: 93
end_time is of type: 93
AS STRING start_time: 2019-02-20 00:0-53:46.000000, end_time: 2019-02-20 00:0-53:53.000000
AS TIMESTAMP start_time: 2019-02-19 23:07:46.0, end_time: 2019-02-19 23:07:53.0
start_time
and end_time
are both of type 93 or Timestamp.
Notice how the second event, which should be starting on 00:07, has jumped an hour into the past to 23:07
Where am I going wrong to have this one-hour offset?