本文整理了Java中org.threeten.bp.LocalDate.getMonthValue()
方法的一些代码示例,展示了LocalDate.getMonthValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.getMonthValue()
方法的具体详情如下:
包路径:org.threeten.bp.LocalDate
类名称:LocalDate
方法名:getMonthValue
[英]Gets the month-of-year field from 1 to 12.
This method returns the month as an int from 1 to 12. Application code is frequently clearer if the enum Monthis used by calling #getMonth().
[中]获取从1到12的月份字段。
此方法将月份返回为1到12之间的整数。如果调用#getMonth()使用枚举月,则应用程序代码通常更清晰。
代码示例来源:origin: prolificinteractive/material-calendarview
/**
* Get the month, represented by values from {@linkplain LocalDate}
*
* @return the month of the year as defined by {@linkplain LocalDate}
*/
public int getMonth() {
return date.getMonthValue();
}
代码示例来源:origin: prolificinteractive/material-calendarview
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(date.getYear());
dest.writeInt(date.getMonthValue());
dest.writeInt(date.getDayOfMonth());
}
代码示例来源:origin: prolificinteractive/material-calendarview
@Override
public String toString() {
return "CalendarDay{" + date.getYear() + "-" + date.getMonthValue() + "-"
+ date.getDayOfMonth() + "}";
}
代码示例来源:origin: prolificinteractive/material-calendarview
@Override
public int hashCode() {
return hashCode(date.getYear(), date.getMonthValue(), date.getDayOfMonth());
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return date.getMonthValue();
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return date.getMonthValue();
}
代码示例来源:origin: ThreeTen/threetenbp
private long getProlepticMonth() {
return getProlepticYear() * 12L + isoDate.getMonthValue() - 1;
}
代码示例来源:origin: ThreeTen/threetenbp
private long getProlepticMonth() {
return getProlepticYear() * 12L + isoDate.getMonthValue() - 1;
}
代码示例来源:origin: org.threeten/threetenbp
private long getProlepticMonth() {
return getProlepticYear() * 12L + isoDate.getMonthValue() - 1;
}
代码示例来源:origin: org.threeten/threetenbp
private long getProlepticMonth() {
return getProlepticYear() * 12L + isoDate.getMonthValue() - 1;
}
代码示例来源:origin: ThreeTen/threetenbp
@Override
public int lengthOfYear() {
Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
return jcal.getActualMaximum(Calendar.DAY_OF_YEAR);
}
代码示例来源:origin: org.threeten/threetenbp
@Override
public int lengthOfYear() {
Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
return jcal.getActualMaximum(Calendar.DAY_OF_YEAR);
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Converts a {@code LocalDate} to a {@code java.sql.Date}.
*
* @param date the local date, not null
* @return the SQL date, not null
*/
@SuppressWarnings("deprecation")
public static java.sql.Date toSqlDate(LocalDate date) {
return new java.sql.Date(date.getYear() - 1900, date.getMonthValue() -1, date.getDayOfMonth());
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Converts a {@code LocalDate} to a {@code java.sql.Date}.
*
* @param date the local date, not null
* @return the SQL date, not null
*/
@SuppressWarnings("deprecation")
public static java.sql.Date toSqlDate(LocalDate date) {
return new java.sql.Date(date.getYear() - 1900, date.getMonthValue() -1, date.getDayOfMonth());
}
代码示例来源: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: org.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: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
public void serialize(LocalDate date, JsonGenerator generator, SerializerProvider provider) throws IOException
{
if (useTimestamp(provider)) {
generator.writeStartArray();
generator.writeNumber(date.getYear());
generator.writeNumber(date.getMonthValue());
generator.writeNumber(date.getDayOfMonth());
generator.writeEndArray();
} else {
String str = (_formatter == null) ? date.toString() : date.format(_formatter);
generator.writeString(str);
}
}
代码示例来源:origin: org.springframework.data/spring-data-cassandra
@Override
public com.datastax.driver.core.LocalDate convert(LocalDate source) {
return com.datastax.driver.core.LocalDate.fromYearMonthDay(source.getYear(), source.getMonthValue(),
source.getDayOfMonth());
}
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Obtains a local date in Japanese calendar system from the
* proleptic-year and day-of-year fields.
* <p>
* The day-of-year in this factory is expressed relative to the start of the proleptic year.
* The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system.
* They are not reset when the era changes.
*
* @param prolepticYear the proleptic-year
* @param dayOfYear the day-of-year
* @return the Japanese local date, not null
* @throws DateTimeException if unable to create the date
*/
@Override
public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) {
LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Obtains a local date in Japanese calendar system from the
* proleptic-year and day-of-year fields.
* <p>
* The day-of-year in this factory is expressed relative to the start of the proleptic year.
* The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system.
* They are not reset when the era changes.
*
* @param prolepticYear the proleptic-year
* @param dayOfYear the day-of-year
* @return the Japanese local date, not null
* @throws DateTimeException if unable to create the date
*/
@Override
public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) {
LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
}
内容来源于网络,如有侵权,请联系作者删除!