Java: how do I check if a Date is within a certain range?

后端 未结 12 667
耶瑟儿~
耶瑟儿~ 2020-11-22 16:39

I have a series of ranges with start dates and end dates. I want to check to see if a date is within that range.

Date.before() and Date.after() seem to be a little a

12条回答
  •  被撕碎了的回忆
    2020-11-22 17:14

    An easy way is to convert the dates into milliseconds after January 1, 1970 (use Date.getTime()) and then compare these values.

提交回复
热议问题