Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Checking for a certain date?

Posted on 2000-05-11
2
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

688 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