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?
Your DateFormat instance is most likely displaying the value in local time. When displaying your value, give this a try:
EDIT: to your comment:
SimpleDateFormat can use general timezones (GMT +/- n), RFC822, and text ("if they have names" as the JavaDoc states – see this post for info on the names).