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 > > > > > > > __________________________________ > Yahoo! Mail - PC Magazine Editors' Choice 2005 > http://mail.yahoo.com > > _______________________________________________ > Juglist mailing list > [email protected] > http://trijug.org/mailman/listinfo/juglist_trijug.org > _______________________________________________ Juglist mailing list [email protected] http://trijug.org/mailman/listinfo/juglist_trijug.org
