Daylight Savings problem using GMT-5

Hi All,

How to retreive the time for the GMT-5 timezone with the DST applied. Below is the sample code to convert the date to a specific timezone.

SimpleDateFormat sdf = null;

Date date = null;

sdf = new SimpleDateFormat("M/d/y h:m:s a");

date = sdf.parse("5/1/2007 10:30:00 AM");

System.out.print("5/1/2007 10:30:00 AM ====== "+getGMTOffset("GMT-5", date.getTime()));

Above code does not retreive the time as per the DST. I'm using JDK 1.4.2_13 (DST patch) JDK version. Any code with the GMT time zone is not converted to the DST. If I use the EST or America/New_York in place of GMT-5 the time is correct as per DST.

Since GMT-5 is same as EST I should be able to use any of the values.

Thanks in advance

AV.

[779 byte] By [AravindUSAa] at [2007-11-27 5:57:46]
# 1
> GMT-5 is same as ESTNot true. They are different time zones, and one way is that GMT zones are not defined as observing DST. Ther are many time zones that share the same offset from 0 hrs GMT, but differ in other ways.
ChuckBinga at 2007-7-12 16:31:12 > top of Java-index,Desktop,Runtime Environment...
# 2

Thank you for the information.

I did check the below code for both daylight savings (DST) and non-DST dates

SimpleDateFormat sdf = null;

Date date = null;

sdf = new SimpleDateFormat("M/d/y h:m:s a");

date = sdf.parse("3/1/2007 10:30:00 AM");

System.out.print("3/1/2007 10:30:00 AM ====== "+getGMTOffset("EST", date.getTime()));

output is -18000000

date = sdf.parse("3/15/2007 10:30:00 AM");

System.out.print("3/15/2007 10:30:00 AM ====== "+getGMTOffset("EST",

output is -14400000

The output is different for 3/1 vs 3/15 as the DST starts from 3/11.

I executed the same code for time zone GMT-5 on 3/1 and 3/15 the output remains same. They do not change even the DST starts on 3/11 for the GMT-5 timezone.

Could this say that the GMT-5 is not effected by DST.

In my application I need to handle the Daylight Savings for GMT-5 as it is handled default by the JRE.

Thanks

AV

AravindUSAa at 2007-7-12 16:31:12 > top of Java-index,Desktop,Runtime Environment...