当前位置: 动力学知识库 > 问答 > 编程问答 >

java - How to set task to run after a certain time in the day?

问题描述:

Right now I have a class that writes reservations for a resort into a .dat file

Each day I would like to automatically check them out if the current date is more than or equal their checkout date.

So if its 12:40 in the day, then the function would automatically check out anyone whose checkout date is today. If its 11:40, then no.

Im really hoping for a non-TimerTask implementation since this method is within another class and Im restricted to it.

I currently use the Calender Class for dates.

网友答案:

Do you want to auto-checkout if someone reserves after 12.00? Which means the "first customer after noon" is the trigger for the checkout? If not, you will have to use a timer of some sort.

If you have enough customers to use the customer-driven auto-checkout, it's just a matter of checking if it's after 12.00...?

分享给朋友:
您可能感兴趣的文章:
随机阅读: