[Java] I want to determine the range using the month

less than 1 minute read


I want to get it before September when I have monthly data, Since January, February, and March are data for the next year, I think there is something I don’t want to include. At that time, take note of an example of a simple removal method.

How to do

Convert each month to be compared as follows, It can be solved by making a judgment using the converted value.

(Monthly + 8) %12

For example, when acquiring data for September and earlier, By setting the monthly conversion value of the acquisition source data <= the standard monthly conversion value, It will only be available in April, June, July, August, and September. Because the converted value is as follows. The converted value for September is “5”, so you can get April to September, which is less than that value.

Month Converted value
1 9
2 10
3 11
4 0
5 1
6 2
7 3
8 4
9 5
10 6
11 7
12 8