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

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

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

LocalDateTime.plusHours介绍

[英]Returns a copy of this datetime plus the specified number of hours.

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

The following three lines are identical in effect:

LocalDateTime added = dt.plusHours(6); 
LocalDateTime added = dt.plus(Period.hours(6)); 
LocalDateTime added = dt.withFieldAdded(DurationFieldType.hours(), 6);

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

LocalDateTime added = dt.plusHours(6); 
LocalDateTime added = dt.plus(Period.hours(6)); 
LocalDateTime added = dt.withFieldAdded(DurationFieldType.hours(), 6);

代码示例

代码示例来源:origin: apache/incubator-gobblin

@Override
public LocalDateTime next() {
 LocalDateTime dateTime = startDate;
 startDate = this.isDatePatternHourly ? startDate.plusHours(1) : startDate.plusDays(1);
 return dateTime;
}

代码示例来源:origin: org.apache.gobblin/gobblin-data-management

@Override
public LocalDateTime next() {
 LocalDateTime dateTime = startDate;
 startDate = this.isDatePatternHourly ? startDate.plusHours(1) : startDate.plusDays(1);
 return dateTime;
}

代码示例来源:origin: com.synaptix/SynaptixWidget

case 'H':
case 'h':
  dateTime = dateTime.plusHours(nb);
  break;
case 'm':

代码示例来源:origin: effektif/effektif

@Test
public void testIn7Hours() {
 LocalDateTime base = new LocalDateTime(2015, 12, 28, 9, 0, 0, 0);
 LocalDateTime absoluteTime = RelativeTime.hours(7).resolve(base);
 assertEquals(base.plusHours(7), absoluteTime);
}

代码示例来源:origin: effektif/effektif

Time.now = new LocalDateTime().plusHours(2);

相关文章