How to detect if a date is within this or next week in java?

前端 未结 5 2057
半阙折子戏
半阙折子戏 2021-02-15 02:05

If I have a date of an event, such as 2011-01-03, how to detect if it is within this or next week in java ? Any sample code ?

Edit :

I thought it was a simple qu

5条回答
  •  执念已碎
    2021-02-15 02:34

    Hint: use Calendar. Create new instance of it for your sample event date. Then, compare WEEK_OF_YEAR for current date, and the date of your event.

提交回复
热议问题