> SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
> HH:mm:ss z");
[quoted text clipped - 10 lines]
> How can i do it such that the piece of code would always offset the
> time correctly?
SimpleDateFormat extends DateFormat, so it inherits a method called
setTimeZone. That does what you want, if I understand you well.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Steve W. Jackson - 11 May 2006 17:04 GMT
> > SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
> > HH:mm:ss z");
[quoted text clipped - 13 lines]
> SimpleDateFormat extends DateFormat, so it inherits a method called
> setTimeZone. That does what you want, if I understand you well.
While calling setTimeZone will provide the result, it might be better to
use a Calendar, or perhaps a GregorianCalendar. This should
automatically contain a date/time with time zone info included.
SimpleDateFormat inherits the setCalendar method, too, and calling that
will give it the information included in a new Date object but include
TZ data as well.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama