当前位置: 首页>>代码示例>>Java>>正文


Java OffsetDateTime.withMinute方法代码示例

本文整理汇总了Java中java.time.OffsetDateTime.withMinute方法的典型用法代码示例。如果您正苦于以下问题:Java OffsetDateTime.withMinute方法的具体用法?Java OffsetDateTime.withMinute怎么用?Java OffsetDateTime.withMinute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.OffsetDateTime的用法示例。


在下文中一共展示了OffsetDateTime.withMinute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: areInSameTimeFrame

import java.time.OffsetDateTime; //导入方法依赖的package包/类
@Override
public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) {
    final OffsetDateTime localBase = instant1.atOffset(UTC).withSecond(0).withNano(0);
    final OffsetDateTime localStart = localBase.withMinute(localBase.getMinute() - localBase.getMinute() % 30);

    final Instant start = localStart.toInstant();
    final Instant startOfNext = localStart.plusMinutes(30).toInstant();

    return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext));
}
 
开发者ID:rbi,项目名称:trading4j,代码行数:11,代码来源:M30.java

示例2: areInSameTimeFrame

import java.time.OffsetDateTime; //导入方法依赖的package包/类
@Override
public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) {
    final OffsetDateTime localBase = instant1.atOffset(UTC).withSecond(0).withNano(0);
    final OffsetDateTime localStart = localBase.withMinute(localBase.getMinute() - localBase.getMinute() % 5);

    final Instant start = localStart.toInstant();
    final Instant startOfNext = localStart.plusMinutes(5).toInstant();

    return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext));
}
 
开发者ID:rbi,项目名称:trading4j,代码行数:11,代码来源:M5.java

示例3: areInSameTimeFrame

import java.time.OffsetDateTime; //导入方法依赖的package包/类
@Override
public boolean areInSameTimeFrame(final Instant instant1, final Instant instant2) {
    final OffsetDateTime localBase = instant1.atOffset(UTC).withSecond(0).withNano(0);
    final OffsetDateTime localStart = localBase.withMinute(localBase.getMinute() - localBase.getMinute() % 15);

    final Instant start = localStart.toInstant();
    final Instant startOfNext = localStart.plusMinutes(15).toInstant();

    return instant2.equals(start) || (instant2.isAfter(start) && instant2.isBefore(startOfNext));
}
 
开发者ID:rbi,项目名称:trading4j,代码行数:11,代码来源:M15.java

示例4: test_withMinute_normal

import java.time.OffsetDateTime; //导入方法依赖的package包/类
@Test
public void test_withMinute_normal() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.withMinute(15);
    assertEquals(test, OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 15, 59), OFFSET_PONE));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TCKOffsetDateTime.java

示例5: test_withMinute_noChange

import java.time.OffsetDateTime; //导入方法依赖的package包/类
@Test
public void test_withMinute_noChange() {
    OffsetDateTime base = OffsetDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30, 59), OFFSET_PONE);
    OffsetDateTime test = base.withMinute(30);
    assertSame(test, base);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TestOffsetDateTime.java


注:本文中的java.time.OffsetDateTime.withMinute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。