SimpleDateFormat parse changes time zone

B

brisco5

I'm running into a bizarre problem that appears to only occur in
WebLogic.
Here's the code I'm using:

SimpleDateFormat sdf = new SimpleDateFormat("d MMM yyyy hh:mm:ss a z",
Locale.getDefault());

Date lDate = sdf.parse("30 Oct 2007 12:00:00 AM EDT");

lDate, however, will equal Mon Oct 29, 23:00:00 EST 2007

This only occurs for certain dates. I've found it happening from
October 28th through November 4th, but that's not set in stone.
It seems like the parser is changing the time zone from EDT to EST,
which sets the time back an hour, which ends up rolling the day back
one.

This doesn't seem to happen in Webpshere or Tomcat.
I'm baffled.

Any ideas?
 
L

Lew

I'm running into a bizarre problem that appears to only occur in
WebLogic.
Here's the code I'm using:

SimpleDateFormat sdf = new SimpleDateFormat("d MMM yyyy hh:mm:ss a z",
Locale.getDefault());

Date lDate = sdf.parse("30 Oct 2007 12:00:00 AM EDT");

lDate, however, will equal Mon Oct 29, 23:00:00 EST 2007

This only occurs for certain dates. I've found it happening from
October 28th through November 4th, but that's not set in stone.
It seems like the parser is changing the time zone from EDT to EST,
which sets the time back an hour, which ends up rolling the day back
one.

This doesn't seem to happen in Webpshere or Tomcat.
I'm baffled.

Any ideas?

Which JVM is it using? Maybe it's not been patched for the Daylight Saving
Time change.

<http://java.sun.com/developer/technicalArticles/Intl/tzupdatertool.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,236
Latest member
ShondaSchu

Latest Threads

Top