Hi Thank you for reading my post I have an xml file which has some node showing time ranges. I should check this time ranges and compare the current time with stored time ranges, if current time is within those time range, I need to perform some actions.
How are the time ranges stored? As a begin date/time and end/date time?
If so, convert them to a Date object using java.text.DateFormat and/or java.textSimpleDateFormat, create a new Date object without parameters (new Date() will give a Date object for the current moment) and use their compareTo methods.
Thank you for the reply. Problem that I can not resolve is, should I use a Timer to read the file in intevral and check the time range or there are other low overhead method for performing this?
Timer should be fine. Set one to repeat every hour or minutes or whatever you need.
Does the file change? If not, it should be easy to read it once and schedule Timer events for time ranges that are in the future. Tools like Quartz and Cron handle complex schedules.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi