Here you can find the source of isInCurrentWeek(long lTime)
public static boolean isInCurrentWeek(long lTime)
//package com.java2s; import java.util.Calendar; public class Main { public static boolean isInCurrentWeek(long lTime) { Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; }//from w w w. java2 s . c o m nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, -(nDayOfWeek - 1)); if (calUnknown.before(calToday)) { return false; } calToday.add(Calendar.DAY_OF_YEAR, 7); if (calUnknown.after(calToday)) { return false; } return true; } }