Converting a Timestamp from UTC to Etc/GMT+1
We have a webapp that reads a timestamp from a database. The displayed value is always 1 hour less than it should be. Obviously the system does not automatically recompute the (UTC-)timestamp according to our timezone.
What is the best way to convert the value of the timezone manually?
I tried the following, which works, but seems like a real bad approach.
.....
Timestamp timeStamp = rs.getTimestamp("CREATED");
Calendar cal =new GregorianCalendar();
cal.clear();
cal.setTimeZone(TimeZone.getTimeZone("Etc/GMT+1"));
cal.setTime(new java.util.Date(timeStamp.getTime()));
cal.add(Calendar.HOUR_OF_DAY, 1);
.....
Could anybody tell how to do this correctly?
Thanks!
[863 byte] By [
bederta] at [2007-10-1 20:48:23]

thanks for the answer. i've tried the following code now:
private String formatDateTime(Timestamp timeStamp){
DateFormat formatter = new SimpleDateFormat("y'-'MM'-'d' 'H':'m':'s", Locale.GERMANY);
formatter.setTimeZone(TimeZone.getTimeZone("ECT"));
return formatter.format(timeStamp);
}
but the output does not change, it is still the UTC value from the database. Am I doing something wrong?
regards
I've checked the available timezones like you recommended. The Zones I'm using exist. I also tried the following, which does not work either:
private String formatDateTime(Timestamp timeStamp){
DateFormat formatter = new SimpleDateFormat("y'-'MM'-'d' 'H':'m':'s");
formatter.setTimeZone(TimeZone.getTimeZone("Europe/Zurich"));
return formatter.format(timeStamp);
}
Any other idea?