• Post Reply Bookmark Topic Watch Topic
  • New Topic

TimerTask Scheduler  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to start the scheduler at mid-night and schedule at 24 hours interval(every day midnight) ?

TimerTask timerTask = new TimerTask();
Timer timer = new Timer(true);
timer.scheduleAtFixedRate(timerTask, 0, 10*1000);
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like that, only with these changes:

1. The second parameter should be a Date object representing midnight at the end of the current day.

2. The third parameter should be a long value representing the number of milliseconds in 24 hours.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!