当前位置: 首页>>代码示例>>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;未经允许,请勿转载。