This is a tangent, but I create a US Eastern Time Zone GregorianCalendar that 
properly observes EDT rules this way:

GregorianCalendar calendar = new GregorianCalendar(new 
SimpleTimeZone(-18000000, "America/New_York", Calendar.APRIL, 1, 
-Calendar.SUNDAY, 7200000, Calendar.OCTOBER, -1, Calendar.SUNDAY, 7200000, 
3600000));

It works, but it's not pretty.

Regards, 

Hugh


At 08:43 AM 9/21/2005, you wrote:

>It looks like your code *is* correctly parsing the string.  Then when you 
>print it back out with
>System.out.println(<Date>);
>the timezone set on your system is being used to determine what date value to 
>print out.  Notice your input string and the output are 1 hour different - 
>your system is likely set to EDT currently, so the output is one hour 
>different and in EDT.
>
>So your code is parsing the text correctly, you're just printing it out in 
>EDT.  If you want the output to be different, create a Calendar - new 
>GregorianCalendar(new TimeZone(<desired timezone id>)).setTime(<Date>) - and 
>print the output from there.
>
>Eric 
>
>
>> 
>> From: Prashant Pai <[EMAIL PROTECTED]>
>> Date: 2005/09/20 Tue PM 04:35:09 EDT
>> To: [EMAIL PROTECTED],  "Research Triangle Java User's Group mailing list."
>>       <[email protected]>
>> Subject: Re: [Juglist] simpledateformat
>> 
>> The desired output is being able to parse that string.
>> 
>> so if I do
>> 
>> SimpleDateFormat sdf = new
>> SimpleDateFormat("MM/dd/yyyy HH:mm:ss z");
>> 
>> System.out.println(sdf.parse("08/01/2002 12:00:00
>> EST"));
>> 
>> Then I get "Thu Aug 01 13:00:00 EDT 2002"
>> 
>> What do I do to keep it in EST?
>> 
>> Thanks,
>> Prashant.
>> 
>> 
>> --- Kalpeshkumar soni <[EMAIL PROTECTED]> wrote:
>> 
>> > The input date itself shows timezone information
>> > (EST)
>> >  what is the desired output?
>> >  kalpesh
>> > 
>> >  On 9/19/05, Prashant Pai <[EMAIL PROTECTED]>
>> > wrote: 
>> > > 
>> > > I am using a java.text.SimpleDateFormat in Java 5
>> > to
>> > > parse the date "08/01/2002 12:00:00 EST". However,
>> > the
>> > > formatter recognizes my locale and forcibly
>> > applies
>> > > Daylight Savings. How to I tell the formatter to
>> > not
>> > > apply daylight savings?
>> > > 
>> > > TIA,
>> > > Prashant.
>> > > _______________________________________________
>> > Juglist mailing list
>> > [email protected]
>> >
>> http://trijug.org/mailman/listinfo/juglist_trijug.org
>> > 
>> 
>> 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.3/107 - Release Date: 9/20/2005



_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to