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

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

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

Calendar.getMinimum介绍

[英]Returns the smallest minimum value of the given field. this returns the smallest value that get can return for the given field.
[中]返回给定字段的最小值。这将返回get可以为给定字段返回的最小值。

代码示例

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

/**
 * Returns the minimum value of the given field for the current date.
 */
public int getActualMinimum(int field) {
  int value, next;
  if (getMinimum(field) == (next = getGreatestMinimum(field))) {
    return next;
  }
  complete();
  long orgTime = time;
  set(field, next);
  do {
    value = next;
    roll(field, false);
    next = get(field);
  } while (next < value);
  time = orgTime;
  areFieldsSet = false;
  return value;
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

/**
 * Method reduce_constant_length_field
 */
protected static void reduce_constant_length_field(
  int field, Calendar start, Calendar candidate) {
  if ((start.getMaximum(field) != start.getLeastMaximum(field)) ||
    (start.getMinimum(field) != start.getGreatestMinimum(field))) {
    throw new IllegalArgumentException("Not a constant length field");
  }
  int delta = start.get(field) - candidate.get(field);
  if (delta > 0) {
    int fieldLength =
      start.getMaximum(field) - start.getMinimum(field) + 1;
    delta -= fieldLength;
  }
  candidate.add(field, delta);
}

代码示例来源:origin: com.aoindustries/ao-lang

@Override
public int getMinimum(int field) {
  return wrapped.getMinimum(field);
}

代码示例来源:origin: whvcse/EasyWeb

/**
 * 得到当月第一天
 * @return
 */
public static Date getFirstDayOfMonth() {
  Calendar cal = Calendar.getInstance();
  int firstDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
  cal.set(Calendar.DAY_OF_MONTH, firstDay);
  return cal.getTime();
}

代码示例来源:origin: whvcse/EasyWeb

/**
 * 得到下月的第一天
 * @return
 */
public static Date getFirstDayOfNextMonth() {
  Calendar cal = Calendar.getInstance();
  cal.add(Calendar.MONTH, +1);
  int firstDay = cal.getMinimum(Calendar.DAY_OF_MONTH);
  cal.set(Calendar.DAY_OF_MONTH, firstDay);
  return cal.getTime();
}

代码示例来源:origin: netmackan/ATimeTracker

private long startOfDay(long start) {
  Calendar cal = Calendar.getInstance();
  cal.setFirstDayOfWeek(Calendar.MONDAY);
  cal.setTimeInMillis(start);
  cal.set(Calendar.HOUR_OF_DAY, cal.getMinimum(Calendar.HOUR_OF_DAY));
  cal.set(Calendar.MINUTE, cal.getMinimum(Calendar.MINUTE));
  cal.set(Calendar.SECOND, cal.getMinimum(Calendar.SECOND));
  cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND));
  return cal.getTimeInMillis();
}

代码示例来源:origin: apache/roller

/**
 * Returns a Date set to the first possible millisecond of the minute.
 * If a null day is passed in, a new Date is created.
 */
public static Date getStartOfMinute(Date day, Calendar cal) {
  if (day == null) {
    day = new Date();
  }
  cal.setTime(day);
  cal.set(Calendar.SECOND,      cal.getMinimum(Calendar.SECOND));
  cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND));
  return cal.getTime();
}

代码示例来源:origin: org.apache.tomee/openejb-core

public IncrementExpression(final Matcher m, final int field) {
  super(field);
  final int minValue = CALENDAR.getMinimum(field);
  start = m.group(1).equals("*") ? minValue : Integer.parseInt(m.group(1));
  interval = Integer.parseInt(m.group(2));
}

代码示例来源:origin: org.apache.openejb/openejb-core

IncrementExpression(final Matcher m, final int field) {
  super(field);
  final int minValue = CALENDAR.getMinimum(field);
  start = m.group(1).equals("*") ? minValue : Integer.parseInt(m.group(1));
  interval = Integer.parseInt(m.group(2));
}

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

DatePicker datePicker = (DatePicker) getView().findViewById(R.id.your_datepicker_id);   

final Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, c.getMinimum(Calendar.HOUR_OF_DAY));
c.set(Calendar.MINUTE, c.getMinimum(Calendar.MINUTE));
c.set(Calendar.SECOND, c.getMinimum(Calendar.SECOND));
c.set(Calendar.MILLISECOND, c.getMinimum(Calendar.MILLISECOND));

Time now = new Time();
now.setToNow();

datePicker.updateDate(now.year, now.month, now.monthDay);
datePicker.setMinDate(c.getTimeInMillis());

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

public IncrementExpression(Matcher m, int field) {
  super(field);
  int minValue = CALENDAR.getMinimum(field);
  start = m.group(1).equals("*") ? minValue : Integer.parseInt(m.group(1));
  interval = Integer.parseInt(m.group(2));
}

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

final Calendar first = new GregorianCalendar(2010, 9, 1);
final Calendar last = new GregorianCalendar(2010, 10, 1);

Calendar difference = Calendar.getInstance();
difference.setTimeInMillis(last.getTimeInMillis() - first.getTimeInMillis());

int numDays = difference.get(Calendar.DAY_OF_YEAR) - difference.getMinimum(Calendar.DAY_OF_YEAR);

代码示例来源:origin: at.bestsolution.eclipse/com.ibm.icu.base

/**
 * Returns the minimum value for the given time field.
 * e.g., for Gregorian DAY_OF_MONTH, 1.
 * @param field the given time field.
 * @return the minimum value for the given time field.
 * @stable ICU 2.0
 */
public final int getMinimum(int field) {
  return calendar.getMinimum(getJDKField(field));
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base

/**
 * Returns the minimum value for the given time field.
 * e.g., for Gregorian DAY_OF_MONTH, 1.
 * @param field the given time field.
 * @return the minimum value for the given time field.
 * @stable ICU 2.0
 */
public final int getMinimum(int field) {
  return calendar.getMinimum(getJDKField(field));
}

代码示例来源:origin: org.nakedobjects/applib

/**
 * Calculates, and returns, a date representing the first day of the month relative to the current date.
 */
public Date startOfMonth() {
  final Calendar c = Calendar.getInstance();
  c.setTimeZone(UTC_TIME_ZONE);
  c.setTime(date);
  c.set(Calendar.DAY_OF_MONTH, c.getMinimum(Calendar.DAY_OF_MONTH));
  return createDate(c.getTime());
}

代码示例来源:origin: org.nakedobjects/applib

/**
 * Calculates, and returns, a date representing the first day of the year relative to the current date.
 */
public Date startOfYear() {
  final Calendar c = Calendar.getInstance();
  c.setTimeZone(UTC_TIME_ZONE);
  c.setTime(date);
  c.set(Calendar.DAY_OF_YEAR, c.getMinimum(Calendar.DAY_OF_YEAR));
  return createDate(c.getTime());
}

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

private static int calFieldLen(Calendar cal, int field) {
 return cal.getMaximum(field) - cal.getMinimum(field) + 1;
}

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

Calendar mCalendarMax = Calendar.getInstance();
// Set your day - month - year here
mCalendarMax.set(Integer.parseInt(dateMaxData[2]), Integer.parseInt(dateMaxData[1]), Integer.parseInt(dateMaxData[0])); 
mCalendarMax.set(Calendar.HOUR_OF_DAY, mCalendarMax.getMaximum(Calendar.HOUR_OF_DAY));
mCalendarMax.set(Calendar.MINUTE, mCalendarMax.getMaximum(Calendar.MINUTE));
mCalendarMax.set(Calendar.SECOND, mCalendarMax.getMaximum(Calendar.SECOND));
mCalendarMax.set(Calendar.MILLISECOND, mCalendarMax.getMaximum(Calendar.MILLISECOND));

Calendar mCalendarTo = Calendar.getInstance();
// Set your day - month - year here
mCalendarTo.set(Integer.parseInt(dateData[2]),Integer.parseInt(dateData[1]),Integer.parseInt(dateData[0]));

mCalendarTo.set(Calendar.HOUR_OF_DAY, mCalendarTo.getMinimum(Calendar.HOUR_OF_DAY));
mCalendarTo.set(Calendar.MINUTE, mCalendarTo.getMinimum(Calendar.MINUTE));
mCalendarTo.set(Calendar.SECOND, mCalendarTo.getMinimum(Calendar.SECOND));
mCalendarTo.set(Calendar.MILLISECOND, mCalendarTo.getMinimum(Calendar.MILLISECOND));

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

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

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

/**
 * Default JCalendar constructor.
 */
public JYearChooser() {
  setName("JYearChooser");
  final Calendar calendar = Calendar.getInstance();
  dayChooser = null;
  setMinimum(calendar.getMinimum(Calendar.YEAR));
  setMaximum(calendar.getMaximum(Calendar.YEAR));
  setValue(calendar.get(Calendar.YEAR));
}

相关文章