Hi all, I have a problem related to the Daylight saving. It is a code which executes at a particular time say 12.30 CET every week. Normally the daylight start in Netherland in October last sunday. for eg: take the case like this: The Daylight saving starts on 29th of Oct'05. This part of the code executes every week at 12.30 CEST or CET(Even if it is daylight saving it excecutes at 12.30) normaly. On 26th it has executed successfully on at 12.30 CEST. So the next execution time is next week i.e 2nd Nov'05. I monitor the next execution time every day and i keep track of the time every day till the next execution.
Here the real problem starts: After the 26th oct execution at 12.30 CEST...The monitor for the next execution shows that the next execution time as 13.30 CET which is wrong.It has to be normally 12.30 CEt even if it is the Daylight. And the beauty is again on the 30th Oct'05 it again changes the execution time one hour ahead to 14.30 CET and it executes at 14.30 CET on 2nd NOV..again the beauty is..after the execution on 2nd NOV at 14.30 it again changes the time to 12.30 for next execution. I use GregorianCalendar...please help me to solve the problem logically. Is there any problem with the Gregorian Calendar in java?
Look at the TimeZone class, which defines when the daylight savings changes occur. Maybe you need to define a custom TimeZone, but it probably isn't a fault with GregorianCalendar, which doesn't inherently determine daylight savings time changes...
[Pradeep]: The Daylight saving starts on 29th of Oct'05.
It sounds like you have this backwards. Daylight saving time occurs during the summer (plus parts of spring and fall), while standard time occurs the rest of the year. So 29 Oct is when daylight saving time ends in the Netherlands, not when it begins. This makes it hard to understand what you're really saying in several parts of your post. However, here's sample code that may show how to deal with the problem you're having: