The distinction here is that DST is actually starting at a new time in 2007 (a few weeks earlier than it used to) and there's a lot of fuss about what JVM's are handling it correctly.
On Dec 18, 2006, at 6:45 PM, Jerry W. Walker wrote:
Hi, Dan,
You're dealing with a Daylight Savings Time problem.
Yes, the notorious One Hour Shift.
I haven't tried to keep up with Java's calendar routines over the last few months, but if you go to the page on the US Naval Observatory web site that describes clock changes at:
...the first paragraph says:
Currently, daylight time begins in the United States
on the first Sunday in April and ends on the last
Sunday in October. On the first Sunday in April,
clocks are set ahead one hour at 2:00 a.m. local
standard time, which becomes 3:00 a.m. local
daylight time. On the last Sunday in October, clocks
are set back one hour at 2:00 a.m. local daylight
time, which becomes 1:00 a.m. local standard time.
These dates were recently modified with the
passage of the Energy Policy Act of 2005, Pub. L.
no. 109-58, 119 Stat 594 (2005). Starting in
March 2007, daylight time in the United States
will begin on the second Sunday in March and end
on the first Sunday in November.
...and therein lies your problem.
As for a workaround, I'm not sure what to suggest. However, I thought that the later JVMs had adapted to the change in law.
I think that is exactly the problem. We are not in DST now, but late March will be. Java is very "accurate" WRT time and does not handle it as we would in day to day life. 9AM March 21 is not exactly N x 24 hours away, it is N x 24 +/- 1 depending on which way you are crossing the DST boundary. If you have dates at midnight, even the date will change! Much fin ensues. If you don't need the time, setting it to noon will avoid the date shift. That is of no use to you. You can use different formatters (with the time zone set differently) for dates in and out of DST. You could also store the date (at noon) in one field and the in another.
Java. Dates. If there is a hell on earth for developers, it is this.
Chuck
On Dec 18, 2006, at 8:31 PM, Dan Faber wrote:
Hi everyone:
I have just run into an apparent NSTimestamp problem. I have a scheduling program, and it has been working well. Recently we tried to schedule an appt for March, and the NSTimestamp is giving us back a time that is one hour earlier than the time that is designated. This occurs between March 11 and March 31, 2007, a 3 week period. The problem does not seem to occur for dates before that period or afterwards. It does not appear to be an NSTimestampFormatter problem, as it exists with or without using the formatter.
The time is correct in the database after a save, but it immediately gets displayed an hour early. The problem occurs with two different versions of the mysql-connector (including the most recent). It occurs on two different machines, both running OSX version 10.4.8.
Converting the date to java.util.GregorianCalendar appears to produce the correct result for java.util.GregorianCalendar.HOUR_OF_DAY.
So far I have not seen anything on the list about this. Anyone have any ideas what's up?
Dan Faber
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription:
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription:
--
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Help/Unsubscribe/Update your Subscription:
Do not post admin requests to the list. They will be ignored.