티스토리 뷰

모바일/Development

안드로이드 요일 구하기

두뇌미포함 2016.08.15 13:01


Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_WEEK);
String today = "";
switch (day) {
	case Calendar.SUNDAY:
		today = "일";
		break;
	case Calendar.MONDAY:
		today = "월";
		break;
	case Calendar.TUESDAY:
		today = "화";
		break;
	case Calendar.WEDNESDAY:
		today = "수";
		break;
	case Calendar.THURSDAY:
		today = "목";
		break;
	case Calendar.FRIDAY:
		today = "금";
		break;
	case Calendar.SATURDAY:
		today = "토";
		break;
}

※ Calendar.SUNDAY == 1, Calendar.MONDAY == 2 ... 1++


댓글
댓글쓰기 폼