This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Timer with Day light Savings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Timer with Day light Savings" Watch "Java Timer with Day light Savings" New topic
Author

Java Timer with Day light Savings

Radha Gopal
Greenhorn

Joined: Feb 05, 2012
Posts: 13
Hi,

I need to have timer that runs at 9 PM daily. I ahve used the Java timer scheduleAtFixedRate with a 24 hour delay between the runs.

But , when the day light savings occurs, it is going to run either an hour before or hour later. is there any means to make it run at the exact same time ?

Thanks
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19728
    
  10

The solution that comes to my mind is to have a task which runs every hour on the hour, and which works like "If the time is (close to) 9 PM then do (whatever it is)".
Radha Gopal
Greenhorn

Joined: Feb 05, 2012
Posts: 13
Thanks Paul Clapham for your response ..
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3028
    
  10
It may be worthwhile to use Quartz for this. Neither Timer nor ScheduledThreadPoolExecutor supports what you want directly. Either roll your own as Paul C advises, or use a third-party library like Quartz.
 
Have you checked out Aspose?
 
subject: Java Timer with Day light Savings
 
jQuery in Action, 3rd edition