开发者

How to detect if today or tomorrow is the 2nd or last Wed of the month in Java?

开发者 https://www.devze.com 2023-02-02 04:41 出处:网络
How to detect if today or tomorrow is the 2nd or last Wed of the month i开发者_Python百科n Java ? Any sample code ?Use Joda Time Library, which has DateTime class and all the utility methods needed li

How to detect if today or tomorrow is the 2nd or last Wed of the month i开发者_Python百科n Java ? Any sample code ?


Use Joda Time Library, which has DateTime class and all the utility methods needed like plusDays(int),plusWeeks(int)


You having a problem with street-cleaning?

Calendar will tell you if it's a Wednesday (day.get(DAY_OF_WEEK) == WEDNESDAY) and the day of the month. If it's a Wednesday between the 8th and 15th, it's the second of the month; between 22nd and the 29th, it's the fourth.

0

精彩评论

暂无评论...
验证码 换一张
取 消