本文整理了Java中org.joda.time.YearMonth.getYear()
方法的一些代码示例,展示了YearMonth.getYear()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.getYear()
方法的具体详情如下:
包路径:org.joda.time.YearMonth
类名称:YearMonth
方法名:getYear
[英]Get the year field value.
[中]获取年份字段值。
代码示例来源:origin: joda-time/joda-time
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: Graylog2/graylog2-server
@Override
@Nullable
public Object convert(@Nullable String value) {
if (isNullOrEmpty(value)) {
return null;
}
LOG.debug("Trying to parse date <{}> with pattern <{}>, locale <{}>, and timezone <{}>.", value, dateFormat, locale, timeZone);
final DateTimeFormatter formatter;
if (containsTimeZone) {
formatter = DateTimeFormat
.forPattern(dateFormat)
.withDefaultYear(YearMonth.now(timeZone).getYear())
.withLocale(locale);
} else {
formatter = DateTimeFormat
.forPattern(dateFormat)
.withDefaultYear(YearMonth.now(timeZone).getYear())
.withLocale(locale)
.withZone(timeZone);
}
return DateTime.parse(value, formatter);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: Nextdoor/bender
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: redfish64/TinyTravelTracker
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: org.graylog2/graylog2-server
@Override
@Nullable
public Object convert(@Nullable String value) {
if (isNullOrEmpty(value)) {
return null;
}
LOG.debug("Trying to parse date <{}> with pattern <{}> and timezone <{}>.", value, dateFormat, timeZone);
final DateTimeFormatter formatter = DateTimeFormat
.forPattern(dateFormat)
.withLocale(locale)
.withDefaultYear(YearMonth.now(timeZone).getYear())
.withZone(timeZone);
return DateTime.parse(value, formatter);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-console-core
private int getIntervalColumnsCount(Date intervalFrom, Date intervalTo) {
YearMonth yearMonthStart = new YearMonth(intervalFrom.getTime());
YearMonth yearMonthEnd = new YearMonth(intervalTo.getTime());
int yearsDifference = yearMonthEnd.getYear() - yearMonthStart.getYear();
int monthsDifference = yearMonthEnd.getMonthOfYear() - yearMonthStart.getMonthOfYear();
return 1 + yearsDifference * 12 + monthsDifference;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Converts this object to a LocalDate with the same year-month and chronology.
*
* @param dayOfMonth the day of month to use, valid for chronology, such as 1-31 for ISO
* @return a LocalDate with the same year-month and chronology, never null
*/
public LocalDate toLocalDate(int dayOfMonth) {
return new LocalDate(getYear(), getMonthOfYear(), dayOfMonth, getChronology());
}
代码示例来源:origin: astamuse/asta4d
@Test(dataProvider = "string2ym")
public void testString2Java8YearMonth(String s, YearMonth ym) throws Exception {
String2Java8YearMonth convertor = new String2Java8YearMonth();
Assert.assertEquals(convertor.convert(s), java.time.YearMonth.of(ym.getYear(), ym.getMonthOfYear()));
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl
private PersistableMonthItem getMonthItem(PersistablePublicationDownload download, PersistableAbstractReportItem<?> item) {
YearMonth yearMonth = new YearMonth(download.getDownloadDate());
for (PersistableMonthItem monthItem : item.getMonthCounts()) {
YearMonth itemYearMonth = new YearMonth(monthItem.getYear(), monthItem.getMonth());
if (itemYearMonth.equals(yearMonth)) {
return monthItem;
}
}
PersistableMonthItem monthItem = new PersistableMonthItem();
monthItem.setReportItem(item);
monthItem.setMonth(yearMonth.getMonthOfYear());
monthItem.setYear(yearMonth.getYear());
item.getMonthCounts().add(monthItem);
return monthItem;
}
内容来源于网络,如有侵权,请联系作者删除!