Re: simpledateformat

"Richard O. Hammer" <[email protected]>
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <[email protected]>
Does this do what you want?

     SimpleTimeZone myZone = new SimpleTimeZone(-5*60*60*1000,"myZone");
     SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
     sdf.setTimeZone(myZone);
     Date d = sdf.parse("08/01/2002 12:00:00");
     System.out.println(sdf.format(d));

08/01/2002 12:00:00

Rich Hammer


Prashant Pai wrote:
> 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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.