MCPcopy Create free account
hub / github.com/6tail/lunar-java / getIndex

Method getIndex

src/main/java/com/nlf/calendar/SolarWeek.java:163–169  ·  view source on GitHub ↗

获取当前日期是在当月第几周 @return 周序号,从1开始

()

Source from the content-addressed store, hash-verified

161 * @return 周序号,从1开始
162 */
163 public int getIndex() {
164 int offset = Solar.fromYmd(year, month, 1).getWeek() - start;
165 if(offset < 0) {
166 offset += 7;
167 }
168 return (int) Math.ceil((day + offset) / 7D);
169 }
170
171 /**
172 * 获取当前日期是在当年第几周

Callers 13

testMethod · 0.95
test1Method · 0.95
test2Method · 0.95
test3Method · 0.95
test4Method · 0.95
test5Method · 0.95
test6Method · 0.95
test7Method · 0.95
test8Method · 0.95
test9Method · 0.95
nextMethod · 0.95
toStringMethod · 0.95

Calls 2

fromYmdMethod · 0.95
getWeekMethod · 0.45

Tested by 10

testMethod · 0.76
test1Method · 0.76
test2Method · 0.76
test3Method · 0.76
test4Method · 0.76
test5Method · 0.76
test6Method · 0.76
test7Method · 0.76
test8Method · 0.76
test9Method · 0.76