org.threeten.bp.LocalTime.minusSeconds()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(180)

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

LocalTime.minusSeconds介绍

[英]Returns a copy of this LocalTime with the specified period in seconds subtracted.

This subtracts the specified number of seconds from this time, returning a new time. The calculation wraps around midnight.

This instance is immutable and unaffected by this method call.
[中]返回此LocalTime的副本,并减去指定的时间段(以秒为单位)。
这将从该时间减去指定的秒数,返回一个新时间。计算时间大约在午夜。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: stackoverflow.com

LocalTime time1 = LocalTime.of(13, 11);

LocalTime untilTime = time1.minusSeconds(60);

LocalTime currentTime = LocalTime.now();

Duration duration = Duration.between(currentTime, untilTime);

// TODO possibly check duration.isNegative()

Thread.sleep(duration.toMillis());

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
 * <p>
 * This subtracts the specified number of seconds from this time, returning a new time.
 * The calculation wraps around midnight.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the seconds to subtract, may be negative
 * @return an {@code OffsetTime} based on this time with the seconds subtracted, not null
 */
public OffsetTime minusSeconds(long seconds) {
  return with(time.minusSeconds(seconds), offset);
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
 * <p>
 * This subtracts the specified number of seconds from this time, returning a new time.
 * The calculation wraps around midnight.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the seconds to subtract, may be negative
 * @return an {@code OffsetTime} based on this time with the seconds subtracted, not null
 */
public OffsetTime minusSeconds(long seconds) {
  return with(time.minusSeconds(seconds), offset);
}

相关文章