gpt4 book ai didi

java.time.ZoneOffset.ofHoursMinutesSeconds()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 13:18:40 31 4
gpt4 key购买 nike

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

ZoneOffset.ofHoursMinutesSeconds介绍

[英]Obtains an instance of ZoneOffset using an offset in hours, minutes and seconds.

The sign of the hours, minutes and seconds components must match. Thus, if the hours is negative, the minutes and seconds must be negative or zero.
[中]使用小时、分钟和秒的偏移量获取ZoneOffset的实例。
小时、分钟和秒的符号必须匹配。因此,如果小时为负,则分和秒必须为负或零。

代码示例

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

@Test
void shouldTruncateOffsetSeconds()
{
  OffsetTime time = OffsetTime.of( 14, 55, 50, 0, ZoneOffset.ofHoursMinutesSeconds( 2, 15, 45 ) );
  OffsetTime truncatedTime = TemporalUtil.truncateOffsetToMinutes( time );
  assertEquals( OffsetTime.of( 14, 55, 5, 0, ZoneOffset.ofHoursMinutes( 2, 15 ) ), truncatedTime );
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Obtains an instance of {@code ZoneOffset} using an offset in hours.
 *
 * @param hours  the time-zone offset in hours, from -18 to +18
 * @return the zone-offset, not null
 * @throws DateTimeException if the offset is not in the required range
 */
public static ZoneOffset ofHours(int hours) {
  return ofHoursMinutesSeconds(hours, 0, 0);
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Obtains an instance of {@code ZoneOffset} using an offset in
 * hours and minutes.
 * <p>
 * The sign of the hours and minutes components must match.
 * Thus, if the hours is negative, the minutes must be negative or zero.
 * If the hours is zero, the minutes may be positive, negative or zero.
 *
 * @param hours  the time-zone offset in hours, from -18 to +18
 * @param minutes  the time-zone offset in minutes, from 0 to &plusmn;59, sign matches hours
 * @return the zone-offset, not null
 * @throws DateTimeException if the offset is not in the required range
 */
public static ZoneOffset ofHoursMinutes(int hours, int minutes) {
  return ofHoursMinutesSeconds(hours, minutes, 0);
}

代码示例来源:origin: apache/tinkerpop

addExtendedEntry(YearMonth.of(2016, 6), "YearMonth", "The following example is a `YearMonth` of \"June 2016\"", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(ZonedDateTime.of(2016, 12, 23, 12, 12, 24, 36, ZoneId.of("GMT+2")), "ZonedDateTime", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
addExtendedEntry(ZoneOffset.ofHoursMinutesSeconds(3, 6, 9), "ZoneOffset", "The following example is a `ZoneOffset` of three hours, six minutes, and nine seconds.", Compatibilities.UNTYPED_GRAPHSON.matchToArray());

代码示例来源:origin: com.github.seratch/java-time-backport

return ofHoursMinutesSeconds(-hours, -minutes, -seconds);
} else {
  return ofHoursMinutesSeconds(hours, minutes, seconds);

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com