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

Method getIndexInYear

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

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

()

Source from the content-addressed store, hash-verified

174 * @return 周序号,从1开始
175 */
176 public int getIndexInYear() {
177 int offset = Solar.fromYmd(year, 1, 1).getWeek() - start;
178 if(offset < 0) {
179 offset += 7;
180 }
181 return (int) Math.ceil((SolarUtil.getDaysInYear(year, month, day) + offset) / 7D);
182 }
183
184 /**
185 * 周推移

Callers 2

test10Method · 0.95
test11Method · 0.95

Calls 3

fromYmdMethod · 0.95
getDaysInYearMethod · 0.95
getWeekMethod · 0.45

Tested by 2

test10Method · 0.76
test11Method · 0.76