Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep track of the change in date in Java

Tags:

java

I have an application that needs to do some actions every date change say at midnight. Whenever the date changes the application should be said of the same. Any help regarding how to implement the functionality would be appreciated.

like image 424
JavaGeek Avatar asked Mar 29 '10 10:03

JavaGeek


1 Answers

What you're looking for is a scheduler. Quartz is probably the most commonly used scheduler in the Java world, though Spring has some interesting scheduling features if you are already using that framework.

Whichever scheduler you choose, you generally specify an action to occur (sometimes referred to as a "job") and a time for it to happen (a "trigger" in the Quartz terminology). In your case you'd set the trigger to run every day at midnight, and when it fired it would do whatever it was you needed done, as specified by your job.

like image 181
GaryF Avatar answered Oct 25 '22 03:10

GaryF