SELECT statement from MS SQL returns dates with loss of 2-4 days

I use MS SQL Express 2014 to store some data.

I have 3 different tables, each of them contains a DATE type field.

When I do a select statement to each table via JDBC, the ResultSet in some cases returns dates with loss of 2-4 days.

The code looks like:

ResultSet rs = preparedStatement.executeQuery();

while(rs.next()){

java.sql.Date date = rs.getDate("Date");

}

I can't understand the reason of the problem, because

in some cases "date" contains the exact data as field in DB,

and in other cases "date" is losing from 2 to 4 days comparing to DB field.

Thank you!...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts