本文整理了Java中org.joda.time.YearMonthDay.withFieldAdded()
方法的一些代码示例,展示了YearMonthDay.withFieldAdded()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonthDay.withFieldAdded()
方法的具体详情如下:
包路径:org.joda.time.YearMonthDay
类名称:YearMonthDay
方法名:withFieldAdded
[英]Returns a copy of this date with the value of the specified field increased.
If the addition is zero, then this
is returned.
These three lines are equivalent:
YearMonthDay added = ymd.withFieldAdded(DurationFieldType.days(), 6);
YearMonthDay added = ymd.plusDays(6);
YearMonthDay added = ymd.dayOfMonth().addToCopy(6);
[中]返回此日期的副本,指定字段的值增加。
如果加法为零,则返回this
。
这三条线是等效的:
YearMonthDay added = ymd.withFieldAdded(DurationFieldType.days(), 6);
YearMonthDay added = ymd.plusDays(6);
YearMonthDay added = ymd.dayOfMonth().addToCopy(6);
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date plus the specified number of years.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusYears(6);
* YearMonthDay added = dt.plus(Period.years(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.years(), 6);
* </pre>
*
* @param years the amount of years to add, may be negative
* @return the new date plus the increased years
* @since 1.1
*/
public YearMonthDay plusYears(int years) {
return withFieldAdded(DurationFieldType.years(), years);
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date plus the specified number of days.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusDays(6);
* YearMonthDay added = dt.plus(Period.days(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.days(), 6);
* </pre>
*
* @param days the amount of days to add, may be negative
* @return the new date plus the increased days
* @since 1.1
*/
public YearMonthDay plusDays(int days) {
return withFieldAdded(DurationFieldType.days(), days);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date plus the specified number of days.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusDays(6);
* YearMonthDay added = dt.plus(Period.days(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.days(), 6);
* </pre>
*
* @param days the amount of days to add, may be negative
* @return the new date plus the increased days
* @since 1.1
*/
public YearMonthDay plusDays(int days) {
return withFieldAdded(DurationFieldType.days(), days);
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date plus the specified number of months.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusMonths(6);
* YearMonthDay added = dt.plus(Period.months(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.months(), 6);
* </pre>
*
* @param months the amount of months to add, may be negative
* @return the new date plus the increased months
* @since 1.1
*/
public YearMonthDay plusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), months);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date plus the specified number of months.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusMonths(6);
* YearMonthDay added = dt.plus(Period.months(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.months(), 6);
* </pre>
*
* @param months the amount of months to add, may be negative
* @return the new date plus the increased months
* @since 1.1
*/
public YearMonthDay plusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), months);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date plus the specified number of years.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusYears(6);
* YearMonthDay added = dt.plus(Period.years(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.years(), 6);
* </pre>
*
* @param years the amount of years to add, may be negative
* @return the new date plus the increased years
* @since 1.1
*/
public YearMonthDay plusYears(int years) {
return withFieldAdded(DurationFieldType.years(), years);
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date minus the specified number of days.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusDays(6);
* YearMonthDay subtracted = dt.minus(Period.days(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.days(), -6);
* </pre>
*
* @param days the amount of days to subtract, may be negative
* @return the new datetime minus the increased days
* @since 1.1
*/
public YearMonthDay minusDays(int days) {
return withFieldAdded(DurationFieldType.days(), FieldUtils.safeNegate(days));
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date minus the specified number of months.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusMonths(6);
* YearMonthDay subtracted = dt.minus(Period.months(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
* </pre>
*
* @param months the amount of months to subtract, may be negative
* @return the new datetime minus the increased months
* @since 1.1
*/
public YearMonthDay minusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date minus the specified number of years.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusYears(6);
* YearMonthDay subtracted = dt.minus(Period.years(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.years(), -6);
* </pre>
*
* @param years the amount of years to subtract, may be negative
* @return the new datetime minus the increased years
* @since 1.1
*/
public YearMonthDay minusYears(int years) {
return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date minus the specified number of years.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusYears(6);
* YearMonthDay subtracted = dt.minus(Period.years(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.years(), -6);
* </pre>
*
* @param years the amount of years to subtract, may be negative
* @return the new datetime minus the increased years
* @since 1.1
*/
public YearMonthDay minusYears(int years) {
return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date minus the specified number of months.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusMonths(6);
* YearMonthDay subtracted = dt.minus(Period.months(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
* </pre>
*
* @param months the amount of months to subtract, may be negative
* @return the new datetime minus the increased months
* @since 1.1
*/
public YearMonthDay minusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this date minus the specified number of days.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusDays(6);
* YearMonthDay subtracted = dt.minus(Period.days(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.days(), -6);
* </pre>
*
* @param days the amount of days to subtract, may be negative
* @return the new datetime minus the increased days
* @since 1.1
*/
public YearMonthDay minusDays(int days) {
return withFieldAdded(DurationFieldType.days(), FieldUtils.safeNegate(days));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date plus the specified number of days.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusDays(6);
* YearMonthDay added = dt.plus(Period.days(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.days(), 6);
* </pre>
*
* @param days the amount of days to add, may be negative
* @return the new date plus the increased days
* @since 1.1
*/
public YearMonthDay plusDays(int days) {
return withFieldAdded(DurationFieldType.days(), days);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date plus the specified number of years.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusYears(6);
* YearMonthDay added = dt.plus(Period.years(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.years(), 6);
* </pre>
*
* @param years the amount of years to add, may be negative
* @return the new date plus the increased years
* @since 1.1
*/
public YearMonthDay plusYears(int years) {
return withFieldAdded(DurationFieldType.years(), years);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date plus the specified number of months.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusMonths(6);
* YearMonthDay added = dt.plus(Period.months(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.months(), 6);
* </pre>
*
* @param months the amount of months to add, may be negative
* @return the new date plus the increased months
* @since 1.1
*/
public YearMonthDay plusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), months);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date minus the specified number of months.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusMonths(6);
* YearMonthDay subtracted = dt.minus(Period.months(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
* </pre>
*
* @param months the amount of months to subtract, may be negative
* @return the new datetime minus the increased months
* @since 1.1
*/
public YearMonthDay minusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date minus the specified number of days.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusDays(6);
* YearMonthDay subtracted = dt.minus(Period.days(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.days(), -6);
* </pre>
*
* @param days the amount of days to subtract, may be negative
* @return the new datetime minus the increased days
* @since 1.1
*/
public YearMonthDay minusDays(int days) {
return withFieldAdded(DurationFieldType.days(), FieldUtils.safeNegate(days));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this date minus the specified number of years.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusYears(6);
* YearMonthDay subtracted = dt.minus(Period.years(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.years(), -6);
* </pre>
*
* @param years the amount of years to subtract, may be negative
* @return the new datetime minus the increased years
* @since 1.1
*/
public YearMonthDay minusYears(int years) {
return withFieldAdded(DurationFieldType.years(), FieldUtils.safeNegate(years));
}
代码示例来源:origin: org.joda/com.springsource.org.joda.time
/**
* Returns a copy of this date plus the specified number of days.
* <p>
* This date instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay added = dt.plusDays(6);
* YearMonthDay added = dt.plus(Period.days(6));
* YearMonthDay added = dt.withFieldAdded(DurationFieldType.days(), 6);
* </pre>
*
* @param days the amount of days to add, may be negative
* @return the new date plus the increased days
* @since 1.1
*/
public YearMonthDay plusDays(int days) {
return withFieldAdded(DurationFieldType.days(), days);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Returns a copy of this date minus the specified number of months.
* <p>
* This datetime instance is immutable and unaffected by this method call.
* <p>
* The following three lines are identical in effect:
* <pre>
* YearMonthDay subtracted = dt.minusMonths(6);
* YearMonthDay subtracted = dt.minus(Period.months(6));
* YearMonthDay subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
* </pre>
*
* @param months the amount of months to subtract, may be negative
* @return the new datetime minus the increased months
* @since 1.1
*/
public YearMonthDay minusMonths(int months) {
return withFieldAdded(DurationFieldType.months(), FieldUtils.safeNegate(months));
}
内容来源于网络,如有侵权,请联系作者删除!