Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Daylight saving problem

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Marshal
Posts: 27286
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds as if you are describing the behaviour of some program. Do you have the source code for the program?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[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:
 
Pradeep Sivadasan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jim..great help
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic