當前位置: 首頁>>代碼示例>>Java>>正文


Java Calendar.getActualMinimum方法代碼示例

本文整理匯總了Java中java.util.Calendar.getActualMinimum方法的典型用法代碼示例。如果您正苦於以下問題:Java Calendar.getActualMinimum方法的具體用法?Java Calendar.getActualMinimum怎麽用?Java Calendar.getActualMinimum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Calendar的用法示例。


在下文中一共展示了Calendar.getActualMinimum方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: runBaseQuery

import java.util.Calendar; //導入方法依賴的package包/類
private HashMap<String, Long> runBaseQuery(Date date){
    Calendar cal = Calendar.getInstance();
    long DIFF, TIME = System.currentTimeMillis(), START_TIME = System.currentTimeMillis();
    Query baseQuery = em.createQuery(BASE_QUERY);
    HashMap<String, Long> result = new HashMap<String, Long>();
    {
        cal.setTime(date);
        int dayMin = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
        int dayMax = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        cal.set(Calendar.DAY_OF_MONTH, dayMin);
        Parameter<Date> p1 = baseQuery.getParameter("oldStartDate", Date.class);
        baseQuery.setParameter(p1, cal.getTime());
        cal.set(Calendar.DAY_OF_MONTH, dayMax);
        Parameter<Date> p2 = baseQuery.getParameter("oldEndDate", Date.class);
        baseQuery.setParameter(p2, cal.getTime());

        List<Object[]> resultList = baseQuery.getResultList();

        DIFF = (System.currentTimeMillis() - TIME);
        System.out.println("    Q TIME = "+DIFF+"ms");

        for (int i=0; i < resultList.size(); i++){
            Object o[] = resultList.get(i);
            result.put((String)o[1],(Long)o[0]);
        }
    }
    return result;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:29,代碼來源:DailySalesHeatMapFacadeREST.java

示例2: updateCalendar

import java.util.Calendar; //導入方法依賴的package包/類
public void updateCalendar(HashSet<Date> events) {
    ArrayList<Date> cells = new ArrayList<>();
    Calendar calendar = (Calendar) currentDate.clone();

    new SimpleDateFormat("MMM").format(calendar.getTime());
    int actualMinimum = calendar.getActualMinimum(Calendar.DAY_OF_MONTH);
    int monthDisplayIndex = calendar.getTime().getDate() - actualMinimum + 1;

    while (cells.size() < DAYS_COUNT) {
        cells.add(calendar.getTime());
        calendar.add(Calendar.DAY_OF_MONTH, -1);
    }
    CalendarAdapter calendarAdapter = new CalendarAdapter(getContext(), cells, events, monthDisplayIndex);
    grid.setAdapter(calendarAdapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
    grid.setLayoutManager(layoutManager);
    calendarAdapter.notifyDataSetChanged();
    grid.setHasFixedSize(true);
}
 
開發者ID:vixir,項目名稱:Perfect-Day,代碼行數:20,代碼來源:CalendarView.java

示例3: runProductTypeQuery

import java.util.Calendar; //導入方法依賴的package包/類
private HashMap<String, Long> runProductTypeQuery(Date date1, Integer productTypeId){
    long DIFF, TIME = System.currentTimeMillis(), START_TIME = System.currentTimeMillis();
    Query baseQuery = em.createQuery(BASE_TYPE_QUERY);
    Calendar cal = Calendar.getInstance();
    
    HashMap<String, Long> result = new HashMap<String, Long>();
    {
        cal.setTime(date1);
        int dayMin = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
        int dayMax = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        cal.set(Calendar.DAY_OF_MONTH, dayMin);
        Parameter<Date> p1 = baseQuery.getParameter("oldStartDate", Date.class);
        baseQuery.setParameter(p1, cal.getTime());
        cal.set(Calendar.DAY_OF_MONTH, dayMax);
        Parameter<Date> p2 = baseQuery.getParameter("oldEndDate", Date.class);
        baseQuery.setParameter(p2, cal.getTime());
        Parameter<Integer> p3 = baseQuery.getParameter("productTypeId", Integer.class);
        baseQuery.setParameter(p3, productTypeId);

        List<Object[]> resultList = baseQuery.getResultList();

        DIFF = (System.currentTimeMillis() - TIME);
        System.out.println("    Q TIME = "+DIFF+"ms");

        for (int i=0; i < resultList.size(); i++){
            Object o[] = resultList.get(i);
            result.put((String)o[1],(Long)o[0]);
        }
    }
    
    return result;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:33,代碼來源:DailySalesHeatMapFacadeREST.java

示例4: getFirstDayOfMonth

import java.util.Calendar; //導入方法依賴的package包/類
/**
 * Antwortet das Datum des ersten Tags des Monats, in der <code>date</code>
 * liegt
 *
 * @return Date
 */
public static Date getFirstDayOfMonth(Date date) {

	Calendar calendar = getCalendar(date);
	int firstDate = calendar.getActualMinimum(Calendar.DATE);
	calendar.set(Calendar.DATE, firstDate);
	return calendar.getTime();
}
 
開發者ID:dvbern,項目名稱:date-helper,代碼行數:14,代碼來源:DateHelper.java

示例5: _getActualMinimumDayOfMonth

import java.util.Calendar; //導入方法依賴的package包/類
/**
 * Get the first day of the month.
 */
private static int _getActualMinimumDayOfMonth(
  Calendar calendar
  )
{
  return calendar.getActualMinimum(Calendar.DAY_OF_MONTH);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:10,代碼來源:ChooseDateRenderer.java

示例6: firstDayOfMonth

import java.util.Calendar; //導入方法依賴的package包/類
/**
 * 返回傳入時間月份的第一天
 * */
public static Date firstDayOfMonth(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    int value = cal.getActualMinimum(Calendar.DAY_OF_MONTH);
    cal.set(Calendar.DAY_OF_MONTH, value);
    return cal.getTime();
}
 
開發者ID:warlock-china,項目名稱:azeroth,代碼行數:11,代碼來源:DateUtils.java

示例7: DenyAfterConstraint

import java.util.Calendar; //導入方法依賴的package包/類
DenyAfterConstraint(String algo, int year, int month, int day) {
    Calendar c;

    algorithm = algo;

    if (debug != null) {
        debug.println("DenyAfterConstraint read in as:  year " +
                year + ", month = " + month + ", day = " + day);
    }

    c = new Calendar.Builder().setTimeZone(TimeZone.getTimeZone("GMT"))
            .setDate(year, month - 1, day).build();

    if (year > c.getActualMaximum(Calendar.YEAR) ||
            year < c.getActualMinimum(Calendar.YEAR)) {
        throw new IllegalArgumentException(
                "Invalid year given in constraint: " + year);
    }
    if ((month - 1) > c.getActualMaximum(Calendar.MONTH) ||
            (month - 1) < c.getActualMinimum(Calendar.MONTH)) {
        throw new IllegalArgumentException(
                "Invalid month given in constraint: " + month);
    }
    if (day > c.getActualMaximum(Calendar.DAY_OF_MONTH) ||
            day < c.getActualMinimum(Calendar.DAY_OF_MONTH)) {
        throw new IllegalArgumentException(
                "Invalid Day of Month given in constraint: " + day);
    }

    denyAfterDate = c.getTime();
    if (debug != null) {
        debug.println("DenyAfterConstraint date set to: " +
                dateFormat.format(denyAfterDate));
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:DisabledAlgorithmConstraints.java

示例8: TestActualMinMax

import java.util.Calendar; //導入方法依賴的package包/類
public void TestActualMinMax() {
    Calendar cal = new GregorianCalendar(1967, MARCH, 10);
    cal.setFirstDayOfWeek(SUNDAY);
    cal.setMinimalDaysInFirstWeek(3);

    if (cal.getActualMinimum(DAY_OF_MONTH) != 1) {
        errln("Actual minimum date for 3/10/1967 should have been 1; got "
                + cal.getActualMinimum(DAY_OF_MONTH));
    }
    if (cal.getActualMaximum(DAY_OF_MONTH) != 31) {
        errln("Actual maximum date for 3/10/1967 should have been 31; got "
                + cal.getActualMaximum(DAY_OF_MONTH));
    }

    cal.set(MONTH, FEBRUARY);
    if (cal.getActualMaximum(DAY_OF_MONTH) != 28) {
        errln("Actual maximum date for 2/10/1967 should have been 28; got "
                + cal.getActualMaximum(DAY_OF_MONTH));
    }
    if (cal.getActualMaximum(DAY_OF_YEAR) != 365) {
        errln("Number of days in 1967 should have been 365; got "
                + cal.getActualMaximum(DAY_OF_YEAR));
    }

    cal.set(YEAR, 1968);
    if (cal.getActualMaximum(DAY_OF_MONTH) != 29) {
        errln("Actual maximum date for 2/10/1968 should have been 29; got "
                + cal.getActualMaximum(DAY_OF_MONTH));
    }
    if (cal.getActualMaximum(DAY_OF_YEAR) != 366) {
        errln("Number of days in 1968 should have been 366; got "
                + cal.getActualMaximum(DAY_OF_YEAR));
    }
    // Using week settings of SUNDAY/3 (see above)
    if (cal.getActualMaximum(WEEK_OF_YEAR) != 52) {
        errln("Number of weeks in 1968 should have been 52; got "
                + cal.getActualMaximum(WEEK_OF_YEAR));
    }

    cal.set(YEAR, 1976);
    // Using week settings of SUNDAY/3 (see above)
    if (cal.getActualMaximum(WEEK_OF_YEAR) != 53) {
        errln("Number of weeks in 1976 should have been 53; got "
                + cal.getActualMaximum(WEEK_OF_YEAR));
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:47,代碼來源:CalendarTest.java


注:本文中的java.util.Calendar.getActualMinimum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。