Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Checking for a certain date?

Posted on 2000-05-11
2
Medium Priority
?
168 Views
Last Modified: 2010-04-01
How can I check for if a certain date have occured? The problem is that once a month I want certain tasks to be executed. Is there some class for this? I want to be able to set a certain date and when it occures I want an event to be raised.
0
Comment
Question by:sa9813
  • 2
2 Comments
 
LVL 5

Accepted Solution

by:
msmolyak earned 150 total points
ID: 2800512
Java 1.3 (just released) has a class java.util.Timer. The purpose of this class is to allow scheduling a thread at a specified time. The task to be executed should be of type TimneTask (which implements Runnable and ads a few more methods).

The timer allows for scheduling at a particular time or in specified intervals. In you case I would suggest scheduling at a specified time and at the end of each monthly task schedulling the next one.

The alternative is to have thread (a Timer thread) which wakes up periodically and checks the date (or date and time). If they match a specified date (or date and time), it will start the task thread.
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 2800522
To check whether the date occured you can use java.util.Calendar methods before(), after() or get().
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question