gpt4 book ai didi

java - 如何从整个月的日历中跳过周末(周六和周日)

转载 作者:行者123 更新时间:2023-12-02 01:33:08 26 4
gpt4 key购买 nike

尝试从月历中跳过周末

Calendar cal = Calendar.getInstance();
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
for (int i = 0; i < dayOfMonth; i++) {
id("prevDayTrackButton").click();
Thread.sleep(1000);
}

最佳答案

int dayOfWeek = cal.get (Calendar.DAY_OF_WEEK);
boolean isWeekday = ((dayOfWeek >= Calendar.MONDAY) && (dayOfWeek <= Calendar.FRIDAY));
如果星期几是 星期六星期日

isWeekday将为false

关于java - 如何从整个月的日历中跳过周末(周六和周日),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55724489/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com