public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
System.out.println("Calendar.SUNDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
System.out.println("Calendar.MONDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
System.out.println("Calendar.TUESDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
System.out.println("Calendar.WEDNESDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
System.out.println("Calendar.THURSDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
System.out.println("Calendar.FRIDAY");
} else if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
System.out.println("Calendar.SATURDAY");
}
}
获取当前星期
最新推荐文章于 2023-08-23 18:32:22 发布