Solved

Checking for a certain date?

Posted on 2000-05-11
2
162 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 50 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 39
ForLoop Example 3 49
couple of eclipse 5 38
String array comparison 4 34
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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.

831 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