Here you can find the source of getSeqWeek(String date)
public static String getSeqWeek(String date)
//package com.java2s; import java.util.Calendar; public class Main { public static String getSeqWeek(String date) { int seqWeek = 0; int curDate = getDate(date); int[][] month = getMonthDays(date); for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { if (month[i][j] != 0) { if (month[i][j] == curDate) seqWeek = i + 1; }/*from ww w . ja v a 2 s. c o m*/ } } switch (seqWeek) { case 1: return "()"; case 2: return "()"; case 3: return "()"; case 4: return "()"; case 5: return "()"; case 6: return "()"; default: return ""; } } public static int getDate(String date) { return Integer.parseInt(date.substring(6, 8)); } public static int[][] getMonthDays(String date) { int[][] months = new int[6][7]; int days = 1; int year = getYear(date); int month = getMonth(date); int day = getDate(date); for (int i = getFirstDayOfWeek(year, month); i < 7; i++) { months[0][i] = days; days++; } for (int i = 1; i < 6; i++) { for (int j = 0; j < 7; j++) { if (days <= LastDateInMonth(year, month, day)) { months[i][j] = days; days++; } else break; } } return months; } public static int getYear(String date) { return Integer.parseInt(date.substring(0, 4)); } public static int getMonth(String date) { return Integer.parseInt(date.substring(4, 6)); } public static int getFirstDayOfWeek(int _year, int _month) { Calendar tmpCal = Calendar.getInstance(); tmpCal.set(_year, _month - 1, 1); return (tmpCal.get(Calendar.DAY_OF_WEEK) - 1); } public static int LastDateInMonth(int _year, int _month, int _day) { Calendar tmpCal = Calendar.getInstance(); tmpCal.set(Calendar.YEAR, _year); tmpCal.set(Calendar.MONTH, _month); tmpCal.set(Calendar.DATE, 0); return (tmpCal.get(Calendar.DATE)); } }