本文整理了Java中java.util.Calendar.getMaximum()
方法的一些代码示例,展示了Calendar.getMaximum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.getMaximum()
方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:getMaximum
[英]Returns the greatest maximum value of the given field. This returns the biggest value that get can return for the given field.
[中]
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* {@inheritDoc}
*/
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: commons-lang/commons-lang
/**
* {@inheritDoc}
*/
public void appendTo(StringBuffer buffer, Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: looly/hutool
/**
* {@inheritDoc}
*/
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: looly/hutool
/**
* {@inheritDoc}
*/
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: igniterealtime/Openfire
@Override
public void appendTo(StringBuffer buffer, Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: robovm/robovm
/**
* Returns the maximum value of the given field for the current date.
* For example, the maximum number of days in the current month.
*/
public int getActualMaximum(int field) {
int value, next;
if (getMaximum(field) == (next = getLeastMaximum(field))) {
return next;
}
complete();
long orgTime = time;
set(field, next);
do {
value = next;
roll(field, true);
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.vaadin/vaadin-server
SimpleDateFormat longMonthFormat = new SimpleDateFormat("MMMM", locale);
int monthsInYear = c.getMaximum(Calendar.MONTH) + 1;
localeData.shortMonthNames = new String[monthsInYear];
localeData.monthNames = new String[monthsInYear];
代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core
@Override
public Integer getPreviousValue(Calendar calendar) {
// Only applicable for seconds, minutes and hours so the actual maximum does not vary
// so currValue is always valid
int maxValue = calendar.getMaximum(field);
int currValue = Math.min(calendar.get(field), maxValue);
int nextValue = currValue - currValue % interval;
return nextValue >= start ? nextValue : null;
}
代码示例来源:origin: stackoverflow.com
Calendar c = Calendar.getInstance();
c.set(Calendar.MONTH, Calendar.MAY); // may is just an example
c.set(Calendar.YEAR, 2012);
int th = 0;
int maxDayInMonth = c.getMaximum(Calendar.MONTH);
for (int d = 1; d <= maxDayInMonth; d++) {
c.set(Calendar.DAY_OF_MONTH, d);
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
if (Calendar.THURSDAY == dayOfWeek) {
th++;
}
}
代码示例来源:origin: stackoverflow.com
public static Date setMaxMillis(Date day,Calendar cal) {
cal.setTime(day);
cal.set(Calendar.MILLISECOND, cal.getMaximum(Calendar.MILLISECOND));
return cal.getTime();
}
Query query = new Query(where("id").is(filter.getId()));
Criteria criteria = Criteria.where("lastModified").gt(setMaxMillis(filter.getLastModified(),Calendar.getInstance()));
query.addCriteria(criteria);
return mongoTemplate.findOne(query, MyDocument.class);
代码示例来源:origin: org.nakedobjects/applib
private void checkDate(final int year, final int month, final int day) {
if ((month < 1) || (month > 12)) {
throw new IllegalArgumentException("Month must be in the range 1 - 12 inclusive");
}
final Calendar cal = Calendar.getInstance();
cal.setTimeZone(UTC_TIME_ZONE);
cal.set(year, month - 1, 0);
final int lastDayOfMonth = cal.getMaximum(Calendar.DAY_OF_MONTH);
if ((day < 1) || (day > lastDayOfMonth)) {
throw new IllegalArgumentException("Day must be in the range 1 - " + lastDayOfMonth + " inclusive: " + day);
}
}
代码示例来源:origin: edu.internet2.middleware.grouper/grouperClient
/**
* {@inheritDoc}
*/
public void appendTo(StringBuffer buffer, Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.ibm.icu.base
/**
* Returns the maximum value for the given time field.
* e.g. for Gregorian DAY_OF_MONTH, 31.
* @param field the given time field.
* @return the maximum value for the given time field.
* @stable ICU 2.0
*/
public final int getMaximum(int field) {
return calendar.getMaximum(getJDKField(field));
}
代码示例来源:origin: org.igniterealtime/tinder
public void appendTo(StringBuffer buffer, Calendar calendar) {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: qiniu/android-sdk
/**
* {@inheritDoc}
*/
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: cn.hutool/hutool-all
/**
* {@inheritDoc}
*/
@Override
public void appendTo(final Appendable buffer, final Calendar calendar) throws IOException {
int value = calendar.get(Calendar.HOUR_OF_DAY);
if (value == 0) {
value = calendar.getMaximum(Calendar.HOUR_OF_DAY) + 1;
}
mRule.appendTo(buffer, value);
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
public YearSpinner() {
Calendar calendar = Calendar.getInstance();
setModel(new SpinnerNumberModel(calendar.get(Calendar.YEAR), 0, calendar.getMaximum(Calendar.YEAR), 1));
setEditor(new JSpinner.NumberEditor(this, "#"));
}
}
内容来源于网络,如有侵权,请联系作者删除!