kelly
kelly

Reputation: 193

java timer - how to scheduletask at a particular time in the future

I have used java.util.Timer to schedule TimerTask to be run every 2 hours .

But how do I schedule a task to run say everynight at 2 am ?

This might be something easy, I am just overlooking something I guess.

Thanks in Advance

Upvotes: 0

Views: 1010

Answers (2)

Mike Q
Mike Q

Reputation: 23229

Call

timer.scheduleAtFixedRate(task, twoAmDate, twentyFourHoursInMillis )

on java.util.Timer

Upvotes: 1

eljenso
eljenso

Reputation: 17027

You could use the Quartz scheduling system with a CronTrigger.

Upvotes: 2

Related Questions