java.util.Calendar.getActualMinimum()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中java.util.Calendar.getActualMinimum()方法的一些代码示例,展示了Calendar.getActualMinimum()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.getActualMinimum()方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:getActualMinimum

Calendar.getActualMinimum介绍

[英]Returns the minimum value of the given field for the current date.
[中]返回当前日期给定字段的最小值。

代码示例

代码示例来源:origin: graphhopper/graphhopper

public Calendar getMin() {
  if (isDayless()) {
    parsedCalendar.set(Calendar.DAY_OF_MONTH, parsedCalendar.getActualMinimum(Calendar.DAY_OF_MONTH));
  }
  parsedCalendar.set(Calendar.HOUR_OF_DAY, parsedCalendar.getActualMinimum(Calendar.HOUR_OF_DAY));
  parsedCalendar.set(Calendar.MINUTE, parsedCalendar.getActualMinimum(Calendar.MINUTE));
  parsedCalendar.set(Calendar.SECOND, parsedCalendar.getActualMinimum(Calendar.SECOND));
  parsedCalendar.set(Calendar.MILLISECOND, parsedCalendar.getActualMinimum(Calendar.MILLISECOND));
  return parsedCalendar;
}

代码示例来源:origin: stackoverflow.com

Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY));
cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE));
cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND));
cal.set(Calendar.MILLISECOND, cal.getActualMinimum(Calendar.MILLISECOND));

代码示例来源:origin: stackoverflow.com

private Date getFirstDateOfCurrentMonth() {
 Calendar cal = Calendar.getInstance();
 cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
 return cal.getTime();
}

代码示例来源:origin: cachecats/coderiver

/**
 * 根据时间获取当月最小的日期,也就是返回当月的1号日期对象
 *
 * @param date Date
 * @return
 * @throws Exception
 */
public static Date minDateOfMonth(Date date) throws Exception {
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  int value = cal.getActualMinimum(Calendar.DATE);
  return dateParse(dateFormat(date, MONTH_PATTERN) + "-" + value, null);
}

代码示例来源:origin: org.apache.commons/commons-lang3

final int min = val.getActualMinimum(aField[0]);
final int max = val.getActualMaximum(aField[0]);

代码示例来源:origin: commons-lang/commons-lang

int min = val.getActualMinimum(fields[i][0]);
int max = val.getActualMaximum(fields[i][0]);

代码示例来源:origin: stackoverflow.com

calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
setTimeToBeginningOfDay(calendar);
begining = calendar.getTime();

代码示例来源:origin: pentaho/pentaho-kettle

cal = Calendar.getInstance();
 cal.add( Calendar.YEAR, -1 );
 cal.set( Calendar.DAY_OF_YEAR, cal.getActualMinimum( Calendar.DATE ) );
 cal.set( Calendar.HOUR_OF_DAY, 0 );
 cal.set( Calendar.MINUTE, 0 );
case TYPE_SYSTEM_INFO_PREV_YEAR_END:
 cal = Calendar.getInstance();
 cal.set( Calendar.DAY_OF_YEAR, cal.getActualMinimum( Calendar.DATE ) );
 cal.add( Calendar.DAY_OF_YEAR, -1 );
 cal.set( Calendar.HOUR_OF_DAY, 23 );
case TYPE_SYSTEM_INFO_THIS_YEAR_START:
 cal = Calendar.getInstance();
 cal.set( Calendar.DAY_OF_YEAR, cal.getActualMinimum( Calendar.DATE ) );
 cal.set( Calendar.HOUR_OF_DAY, 0 );
 cal.set( Calendar.MINUTE, 0 );
 cal = Calendar.getInstance();
 cal.add( Calendar.YEAR, 1 );
 cal.set( Calendar.DAY_OF_YEAR, cal.getActualMinimum( Calendar.DATE ) );
 cal.add( Calendar.DAY_OF_YEAR, -1 );
 cal.set( Calendar.HOUR_OF_DAY, 23 );
 cal = Calendar.getInstance();
 cal.add( Calendar.YEAR, 1 );
 cal.set( Calendar.DAY_OF_YEAR, cal.getActualMinimum( Calendar.DATE ) );
 cal.set( Calendar.HOUR_OF_DAY, 0 );
 cal.set( Calendar.MINUTE, 0 );

代码示例来源:origin: stackoverflow.com

Calendar calendar = Calendar.getInstance();         
calendar.add(Calendar.MONTH, 1);
calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
Date nextMonthFirstDay = calendar.getTime();
calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
Date nextMonthLastDay = calendar.getTime();

代码示例来源:origin: amzn/ion-java

private void checkCalendarDay(int day) {
  int lastDayInMonth = _calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
  if (day > lastDayInMonth || day < _calendar.getActualMinimum(Calendar.DAY_OF_MONTH)) {
    throw new IllegalArgumentException(String.format("Day %s for year %s and month %s must be between 1 and %s inclusive", day, getZYear(), getZMonth(), lastDayInMonth));
  }
}

代码示例来源:origin: info.magnolia/magnolia-module-standard-templating-kit

@Override
public Calendar getMinDate() {
  this.minDate.set(Calendar.YEAR, minDate.getActualMinimum(Calendar.YEAR));
  return minDate;
}

代码示例来源:origin: com.graphhopper/graphhopper-core

public Calendar getMin() {
  if (isDayless()) {
    parsedCalendar.set(Calendar.DAY_OF_MONTH, parsedCalendar.getActualMinimum(Calendar.DAY_OF_MONTH));
  }
  parsedCalendar.set(Calendar.HOUR_OF_DAY, parsedCalendar.getActualMinimum(Calendar.HOUR_OF_DAY));
  parsedCalendar.set(Calendar.MINUTE, parsedCalendar.getActualMinimum(Calendar.MINUTE));
  parsedCalendar.set(Calendar.SECOND, parsedCalendar.getActualMinimum(Calendar.SECOND));
  parsedCalendar.set(Calendar.MILLISECOND, parsedCalendar.getActualMinimum(Calendar.MILLISECOND));
  return parsedCalendar;
}

代码示例来源:origin: metatron-app/metatron-discovery

/**
 * Get first date of month
 *
 * @param date
 * @return
 */
private Date getFirstDateOfMonth(Date date){
  Calendar cal = Calendar.getInstance();
  cal.setTime(date);
  cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
  return cal.getTime();
}

代码示例来源:origin: vakinge/jeesuite-libs

/**
 * 返回传入时间月份的第一天
 * */
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();
}
/**

代码示例来源:origin: org.jboss.bpm/activity-monitor-model

public DayBounds invoke() {
    cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY));
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    t0 = cal.getTimeInMillis();
    cal.set(Calendar.HOUR_OF_DAY, cal.getActualMaximum(Calendar.HOUR_OF_DAY));
    cal.set(Calendar.MINUTE, 59);
    cal.set(Calendar.SECOND, 59);
    t1 = cal.getTimeInMillis();
    return this;
  }
}

代码示例来源:origin: org.richfaces.ui/richfaces-components-ui

protected Date getDefaultPreloadBegin(Date date) {
  FacesContext facesContext = FacesContext.getCurrentInstance();
  Calendar calendar = Calendar.getInstance(CalendarHelper.getTimeZoneOrDefault(this),
      CalendarHelper.getAsLocale(facesContext, this, getLocale()));
  calendar.setTime(date);
  calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE));
  return calendar.getTime();
}

代码示例来源:origin: ThreeTen/threetenbp

private ValueRange actualRange(int calendarField) {
  Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
  jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
  jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
  return ValueRange.of(jcal.getActualMinimum(calendarField),
                 jcal.getActualMaximum(calendarField));
}

代码示例来源:origin: EvoSuite/evosuite

public int getActualMinimum(int field) {
  Capturer.capture(Instrumenter.CAPTURE_ID_JAVA_UTIL_CALENDAR, this, "getActualMinimum", "(I)I", new Object[] {field});
  int ret = wrappedCalendar.getActualMinimum(field);
  Capturer.enable(Instrumenter.CAPTURE_ID_JAVA_UTIL_CALENDAR, this, ret);
  return ret;
}

代码示例来源:origin: org.apache.lucene/lucene-spatial-extras

private int slowSubCells(UnitNRShape lv) {
 int field = FIELD_BY_LEVEL[lv.getLevel()+1];
 //short-circuit optimization (GregorianCalendar assumptions)
 if (field == -1 || field == Calendar.YEAR || field >= Calendar.HOUR_OF_DAY)//TODO make configurable
  return super.getNumSubCells(lv);
 Calendar cal = toCalendar(lv);//somewhat heavyweight op; ideally should be stored on UnitNRShape somehow
 return cal.getActualMaximum(field) - cal.getActualMinimum(field) + 1;
}

代码示例来源:origin: org.geoserver/gs-wms

private java.sql.Date addFeatureWithTimeDayAfterTomorrow(int fid) throws IOException {
  Calendar cal = Calendar.getInstance();
  cal.set(Calendar.HOUR_OF_DAY, cal.getActualMinimum(Calendar.HOUR_OF_DAY));
  cal.set(Calendar.MINUTE, cal.getActualMinimum(Calendar.MINUTE));
  cal.set(Calendar.SECOND, cal.getActualMinimum(Calendar.SECOND));
  cal.set(Calendar.MILLISECOND, cal.getActualMinimum(Calendar.MILLISECOND));
  cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) + 2);
  Date tomorrow = new Date(cal.getTimeInMillis());
  this.addFeature(fid++, tomorrow, Double.valueOf(0d));
  return tomorrow;
}

相关文章