本文整理了Java中org.threeten.bp.LocalDate.getMonth()
方法的一些代码示例,展示了LocalDate.getMonth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.getMonth()
方法的具体详情如下:
包路径:org.threeten.bp.LocalDate
类名称:LocalDate
方法名:getMonth
[英]Gets the month-of-year field using the Month enum.
This method returns the enum Month for the month. This avoids confusion as to what int values mean. If you need access to the primitive int value then the enum provides the Month#getValue().
[中]使用月份枚举获取“月份”字段。
此方法返回当月的枚举月份。这避免了对int值的含义的混淆。如果需要访问原语int值,则枚举将提供Month#getValue()。
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the month-of-year field using the {@code Month} enum.
* <p>
* This method returns the enum {@link Month} for the month.
* This avoids confusion as to what {@code int} values mean.
* If you need access to the primitive {@code int} value then the enum
* provides the {@link Month#getValue() int value}.
*
* @return the month-of-year, not null
* @see #getMonthValue()
*/
public Month getMonth() {
return date.getMonth();
}
代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android
if (day.getMonth() != mCal.getMonth()) {
txtDay.setAlpha(0.3f);
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the month-of-year field using the {@code Month} enum.
* <p>
* This method returns the enum {@link Month} for the month.
* This avoids confusion as to what {@code int} values mean.
* If you need access to the primitive {@code int} value then the enum
* provides the {@link Month#getValue() int value}.
*
* @return the month-of-year, not null
* @see #getMonthValue()
*/
public Month getMonth() {
return date.getMonth();
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the day-of-year field.
* <p>
* This method returns the primitive {@code int} value for the day-of-year.
*
* @return the day-of-year, from 1 to 365, or 366 in a leap year
*/
public int getDayOfYear() {
return getMonth().firstDayOfYear(isLeapYear()) + day - 1;
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the day-of-year field.
* <p>
* This method returns the primitive {@code int} value for the day-of-year.
*
* @return the day-of-year, from 1 to 365, or 366 in a leap year
*/
public int getDayOfYear() {
return getMonth().firstDayOfYear(isLeapYear()) + day - 1;
}
代码示例来源:origin: org.threeten/threetenbp
void adjustToFowards(int year) {
if (adjustForwards == false && dayOfMonth > 0) {
LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
dayOfMonth = adjustedDate.getDayOfMonth();
month = adjustedDate.getMonth();
adjustForwards = true;
}
}
}
代码示例来源:origin: ThreeTen/threetenbp
void adjustToFowards(int year) {
if (adjustForwards == false && dayOfMonth > 0) {
LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
dayOfMonth = adjustedDate.getDayOfMonth();
month = adjustedDate.getMonth();
adjustForwards = true;
}
}
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Obtains the current month-day from the specified clock.
* <p>
* This will query the specified clock to obtain the current month-day.
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current month-day, not null
*/
public static MonthDay now(Clock clock) {
final LocalDate now = LocalDate.now(clock); // called once
return MonthDay.of(now.getMonth(), now.getDayOfMonth());
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Obtains the current month-day from the specified clock.
* <p>
* This will query the specified clock to obtain the current month-day.
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current month-day, not null
*/
public static MonthDay now(Clock clock) {
final LocalDate now = LocalDate.now(clock); // called once
return MonthDay.of(now.getMonth(), now.getDayOfMonth());
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Obtains the current year-month from the specified clock.
* <p>
* This will query the specified clock to obtain the current year-month.
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current year-month, not null
*/
public static YearMonth now(Clock clock) {
final LocalDate now = LocalDate.now(clock); // called once
return YearMonth.of(now.getYear(), now.getMonth());
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Obtains the current year-month from the specified clock.
* <p>
* This will query the specified clock to obtain the current year-month.
* Using this method allows the use of an alternate clock for testing.
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @param clock the clock to use, not null
* @return the current year-month, not null
*/
public static YearMonth now(Clock clock) {
final LocalDate now = LocalDate.now(clock); // called once
return YearMonth.of(now.getYear(), now.getMonth());
}
代码示例来源:origin: SouthernBox/NestedCalendar
@Override
public void onMonthChanged(MaterialCalendarView widget, CalendarDay calendarDay) {
if (calendarBehavior.getCalendarMode() == null) {
return;
}
LocalDate localDate = calendarDay.getDate();
LocalDate newDate;
if (calendarBehavior.getCalendarMode() == CalendarMode.WEEKS) {
newDate = localDate.plusDays(dayOfWeek - 1);
dayOfMonth = newDate.getDayOfMonth();
} else {
int monthDays = localDate.getMonth().length(localDate.isLeapYear());
if (dayOfMonth > monthDays) {
dayOfMonth = monthDays;
}
newDate = localDate.plusDays(dayOfMonth - 1);
dayOfWeek = newDate.getDayOfWeek().getValue();
}
widget.setSelectedDate(newDate);
WeekFields weekFields = WeekFields.of(Locale.getDefault());
calendarBehavior.setWeekOfMonth(newDate.get(weekFields.weekOfMonth()));
setTitle(newDate.getMonth().getValue() + "月");
}
});
代码示例来源:origin: org.threeten/threetenbp
case DAY_OF_MONTH: return ValueRange.of(1, lengthOfMonth());
case DAY_OF_YEAR: return ValueRange.of(1, lengthOfYear());
case ALIGNED_WEEK_OF_MONTH: return ValueRange.of(1, getMonth() == Month.FEBRUARY && isLeapYear() == false ? 4 : 5);
case YEAR_OF_ERA:
return (getYear() <= 0 ? ValueRange.of(1, Year.MAX_VALUE + 1) : ValueRange.of(1, Year.MAX_VALUE));
代码示例来源:origin: ThreeTen/threetenbp
case DAY_OF_MONTH: return ValueRange.of(1, lengthOfMonth());
case DAY_OF_YEAR: return ValueRange.of(1, lengthOfYear());
case ALIGNED_WEEK_OF_MONTH: return ValueRange.of(1, getMonth() == Month.FEBRUARY && isLeapYear() == false ? 4 : 5);
case YEAR_OF_ERA:
return (getYear() <= 0 ? ValueRange.of(1, Year.MAX_VALUE + 1) : ValueRange.of(1, Year.MAX_VALUE));
内容来源于网络,如有侵权,请联系作者删除!