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

x33g5p2x  于2022-01-23 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(207)

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

LocalTime.plusMinutes介绍

[英]Returns a copy of this time plus the specified number of minutes.

This LocalTime instance is immutable and unaffected by this method call.

The following three lines are identical in effect:

LocalTime added = dt.plusMinutes(6); 
LocalTime added = dt.plus(Period.minutes(6)); 
LocalTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6);

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

LocalTime added = dt.plusMinutes(6); 
LocalTime added = dt.plus(Period.minutes(6)); 
LocalTime added = dt.withFieldAdded(DurationFieldType.minutes(), 6);

代码示例

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

assertEquals("3 hours ago", DateUtils.getRelativeTimeSpanString(ctx, LocalTime.now().minusHours(3)));
assertEquals("in 1 min", DateUtils.getRelativeTimeSpanString(ctx, LocalTime.now().plusMinutes(1),
  DateUtils.FORMAT_ABBREV_RELATIVE));
assertEquals("in 30 mins", DateUtils.getRelativeTimeSpanString(ctx, LocalTime.now().plusMinutes(30),
  DateUtils.FORMAT_ABBREV_RELATIVE));
assertEquals("1 min ago", DateUtils.getRelativeTimeSpanString(ctx, LocalTime.now().minusMinutes(1),

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

assertEquals("in 30 seconds, 12:35", DateUtils.getRelativeDateTimeString(ctx, lt.plusSeconds(30), null, 0));
assertEquals("30 seconds ago, 12:34", DateUtils.getRelativeDateTimeString(ctx, lt.minusSeconds(30), null, 0));
assertEquals("in 30 minutes, 13:05", DateUtils.getRelativeDateTimeString(ctx, lt.plusMinutes(30), null, 0));
assertEquals("30 minutes ago, 12:05", DateUtils.getRelativeDateTimeString(ctx, lt.minusMinutes(30), null, 0));

代码示例来源:origin: com.github.almex/raildelays-batch

public static long compareTimeAndDelay(Date departureA, TimestampDelay departureB) {
  long result = 0;
  if (departureA == null && departureB != null) {
    result = 1;
  } else if (departureA != null && departureB == null) {
    result = -1;
  } else if (departureB != null) {
    LocalTime start = new LocalTime(departureA.getTime());
    LocalTime end = new LocalTime(departureB.getExpected()).plusMinutes(departureB.getDelay().intValue());
    Duration duration = new Duration(start.toDateTimeToday(), end.toDateTimeToday());
    result = -duration.getMillis(); // A comparison is an opposite of a duration
  }
  return result;
}

代码示例来源:origin: Jasig/uPortal

checkShutdown();
    this.timeDimensionDao.createTimeDimension(nextTime);
    nextTime = nextTime.plusMinutes(1);
  } while (nextTime.isBefore(dimensionTime));
} else if (nextTime.isAfter(dimensionTime)) {
    checkShutdown();
    this.timeDimensionDao.createTimeDimension(dimensionTime);
    dimensionTime = dimensionTime.plusMinutes(1);
  } while (nextTime.isAfter(dimensionTime));
nextTime = dimensionTime.plusMinutes(1);
  break;
nextTime = nextTime.plusMinutes(1);

相关文章