org.joda.time.YearMonth.plusMonths()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.joda.time.YearMonth.plusMonths()方法的一些代码示例,展示了YearMonth.plusMonths()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.plusMonths()方法的具体详情如下:
包路径:org.joda.time.YearMonth
类名称:YearMonth
方法名:plusMonths

YearMonth.plusMonths介绍

[英]Returns a copy of this year-month plus the specified number of months.

This year-month instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

  1. YearMonth added = ym.plusMonths(6);
  2. YearMonth added = ym.plus(Period.months(6));
  3. YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);

[中]返回本年月份加上指定月份数的副本。
今年的月份实例是不可变的,不受此方法调用的影响。
以下三行实际上是相同的:

  1. YearMonth added = ym.plusMonths(6);
  2. YearMonth added = ym.plus(Period.months(6));
  3. YearMonth added = ym.withFieldAdded(DurationFieldType.months(), 6);

代码示例

代码示例来源:origin: joda-time/joda-time

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: JodaOrg/joda-time

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: pl.edu.icm.synat/synat-console-core

  1. private List<YearMonth> getMonths(Date intervalFrom, Date intervalTo) {
  2. int intervalColumnsCount = getIntervalColumnsCount(intervalFrom, intervalTo);
  3. List<YearMonth> months = new ArrayList<>();
  4. YearMonth yearMonth = new YearMonth(intervalFrom);
  5. for (int i = 0; i < intervalColumnsCount; i++) {
  6. months.add(yearMonth);
  7. yearMonth = yearMonth.plusMonths(1);
  8. }
  9. return months;
  10. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: redfish64/TinyTravelTracker

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

代码示例来源:origin: Nextdoor/bender

  1. /**
  2. * Converts this object to an Interval representing the whole month.
  3. * <p>
  4. * The interval will use the chronology of the year-month in the specified zone.
  5. * <p>
  6. * This instance is immutable and unaffected by this method call.
  7. *
  8. * @param zone the zone to get the Interval in, null means default
  9. * @return an interval over the month, never null
  10. */
  11. public Interval toInterval(DateTimeZone zone) {
  12. zone = DateTimeUtils.getZone(zone);
  13. DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
  14. DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
  15. return new Interval(start, end);
  16. }

相关文章