Java ResultSet how to getTimeStamp in UTC

Posted by mkal on Stack Overflow See other posts from Stack Overflow or by mkal
Published on 2009-09-24T00:32:49Z Indexed on 2010/04/28 0:53 UTC
Read the original article Hit count: 271

Filed under:
|

The database has data in UTC and when I try to get data

java.util.Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
java.sql.Timestamp ts = resultSet.getTimestamp(PUBLISH_TIME);
cal.setTime(ts);

Is there anything wrong with this?

© Stack Overflow or respective owner

Related posts about java

Related posts about jdbc