获取当前星期

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");
		}

	}

你可能感兴趣的:(JavaSE)