java.time.ZonedDateTime.getMinute()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(201)

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

ZonedDateTime.getMinute介绍

[英]Gets the minute-of-hour field.
[中]获取小时分钟字段。

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Returns true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 *
 * @param actual the actual datetime. expected not be null
 * @param other the other datetime. expected not be null
 * @return true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 */
private static boolean areEqualIgnoringSeconds(ZonedDateTime actual, ZonedDateTime other) {
 return areEqualIgnoringMinutes(actual, other) && actual.getMinute() == other.getMinute();
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Returns true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 *
 * @param actual the actual datetime. expected not be null
 * @param other the other datetime. expected not be null
 * @return true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 */
private static boolean areEqualIgnoringSeconds(ZonedDateTime actual, ZonedDateTime other) {
 return areEqualIgnoringMinutes(actual, other) && actual.getMinute() == other.getMinute();
}

代码示例来源:origin: blynkkk/blynk-server

ZonedDateTime buildZonedStartAt(ZonedDateTime zonedNow, ZoneId zoneId) {
  ZonedDateTime zonedStartAt = getZonedFromTs(atTime, zoneId);
  zonedStartAt = zonedNow
      .withHour(zonedStartAt.getHour())
      .withMinute(zonedStartAt.getMinute())
      .withSecond(zonedStartAt.getSecond());
  return adjustToStartDate(zonedStartAt, zonedNow, zoneId);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

public int getMinute() {
  return dt.getMinute();
}

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

private void assertTimestamp(String c4) {
  // '2014-09-08 17:51:04.777'
  // MySQL container is in UTC and the test time is during summer time period
  ZonedDateTime expectedTimestamp = ZonedDateTime.ofInstant(
      LocalDateTime.parse("2014-09-08T17:51:04.780").atZone(ZoneId.of("US/Samoa")).toInstant(),
      ZoneId.systemDefault());
  ZoneId defaultZoneId = ZoneId.systemDefault();
  ZonedDateTime c4DateTime = ZonedDateTime.parse(c4, ZonedTimestamp.FORMATTER).withZoneSameInstant(defaultZoneId);
  assertThat(c4DateTime.getYear()).isEqualTo(expectedTimestamp.getYear());
  assertThat(c4DateTime.getMonth()).isEqualTo(expectedTimestamp.getMonth());
  assertThat(c4DateTime.getDayOfMonth()).isEqualTo(expectedTimestamp.getDayOfMonth());
  assertThat(c4DateTime.getHour()).isEqualTo(expectedTimestamp.getHour());
  assertThat(c4DateTime.getMinute()).isEqualTo(expectedTimestamp.getMinute());
  assertThat(c4DateTime.getSecond()).isEqualTo(expectedTimestamp.getSecond());
  assertThat(c4DateTime.getNano()).isEqualTo(expectedTimestamp.getNano());
  // We're running the connector in the same timezone as the server, so the timezone in the timestamp
  // should match our current offset ...
  LocalDateTime expectedLocalDateTime = LocalDateTime.parse("2014-09-08T17:51:04.780");
  ZoneOffset expectedOffset = defaultZoneId.getRules().getOffset(expectedLocalDateTime);
  assertThat(c4DateTime.getOffset()).isEqualTo(expectedOffset);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Deprecated
public int getMinuteOfHour() {
  logDeprecatedMethod("getMinuteOfHour()", "getMinute()");
  return dt.getMinute();
}

代码示例来源:origin: mulesoft/mule

private void assertTimeZoneWithoutSeconds(ZonedDateTime openingDate) {
 assertEquals(openingDate.getHour(), HOUR);
 assertEquals(openingDate.getMinute(), MINUTE);
}

代码示例来源:origin: mulesoft/mule

private void assertTimeZoneDateTime(ZonedDateTime openingDate) {
 assertEquals(openingDate.getHour(), HOUR);
 assertEquals(openingDate.getMinute(), MINUTE);
 assertEquals(openingDate.getSecond(), SECOND);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Returns true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 *
 * @param actual the actual datetime. expected not be null
 * @param other the other datetime. expected not be null
 * @return true if both datetime are in the same year, month, day of month, hour and minute, false otherwise.
 */
private static boolean areEqualIgnoringSeconds(ZonedDateTime actual, ZonedDateTime other) {
 return areEqualIgnoringMinutes(actual, other) && actual.getMinute() == other.getMinute();
}

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

@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final ZonedDateTime zonedDateTime) {
  output.writeInt(zonedDateTime.getYear());
  output.writeInt(zonedDateTime.getMonthValue());
  output.writeInt(zonedDateTime.getDayOfMonth());
  output.writeInt(zonedDateTime.getHour());
  output.writeInt(zonedDateTime.getMinute());
  output.writeInt(zonedDateTime.getSecond());
  output.writeInt(zonedDateTime.getNano());
  output.writeString(zonedDateTime.getZone().getId());
}

代码示例来源:origin: apache/servicemix-bundles

@Deprecated
public int getMinuteOfHour() {
  logDeprecatedMethod("getMinuteOfHour()", "getMinute()");
  return dt.getMinute();
}

代码示例来源:origin: com.guestful.module/guestful.module.jsr310-extensions

public static ZonedDateTime roundUpMinutes(ZonedDateTime time, int step) {
  int mins = time.getMinute();
  time = time.withSecond(0).withNano(0);
  if (mins % step == 0) return time;
  if (60 % step != 0) throw new IllegalArgumentException("Invalid step: " + step);
  mins = mins + step - (mins % step);
  return mins < 60 ? time.withMinute(mins) : time.plusHours(1).withMinute(mins - 60);
}

代码示例来源:origin: org.apache.james/james-server-util-java8

@Test
public void parseShouldNotThrowWhenMinuteOfHourIsLesserThanTwoDigits() {
  ZonedDateTime dateTime = ZonedDateTime.parse("3 Jun 2017 04:5:11 -0700", ImapDateTimeFormatter.rfc5322());
  assertThat(dateTime.getMinute()).isEqualTo(5);
}

代码示例来源:origin: org.xbib/time

private static ZonedDateTime ymdhm(ZonedDateTime zonedDateTime) {
  return ZonedDateTime.of(zonedDateTime.getYear(), zonedDateTime.getMonthValue(), zonedDateTime.getDayOfMonth(),
      zonedDateTime.getHour(), zonedDateTime.getMinute(), 0, 0, zonedDateTime.getZone());
}

代码示例来源:origin: org.tiogasolutions.dev/tioga-dev-common

public ZonedDateTime toLastDate(ZonedDateTime date) {
 YearMonth yearMonth = toYearMonth(date);
 int lastDayOfMonth = yearMonth.lengthOfMonth();
 return (date == null) ? null : ZonedDateTime.of(date.getYear(), date.getMonthValue(), lastDayOfMonth,
                         date.getHour(), date.getMinute(), date.getSecond(), date.getNano(), date.getZone());
}

代码示例来源:origin: no.ssb.lds/linked-data-store-persistence-provider-foundationdb

static Tuple toTuple(ZonedDateTime timestamp) {
  return Tuple.from(
      -timestamp.getYear(),
      -timestamp.getMonth().getValue(),
      -timestamp.getDayOfMonth(),
      -timestamp.getHour(),
      -timestamp.getMinute(),
      -timestamp.getSecond(),
      -TimeUnit.NANOSECONDS.toMillis(timestamp.getNano())
  );
}

代码示例来源:origin: dlemmermann/CalendarFX

static DateValue zonedDateTimeToDateValue(ZonedDateTime dt) {
  return new DateTimeValueImpl(
      dt.getYear(), dt.getMonthValue(), dt.getDayOfMonth(),
      dt.getHour(), dt.getMinute(), dt.getSecond());
}

代码示例来源:origin: usdot-jpo-ode/jpo-ode

public static String snmpTimestampFromIso(String isoTimestamp) throws ParseException {
 ZonedDateTime zdt = DateTimeUtils.isoDateTime(isoTimestamp);
 byte[] bdt = new byte[6];
 bdt[0] = (byte) zdt.getMonthValue();
 bdt[1] = (byte) zdt.getDayOfMonth();
 bdt[2] = (byte) (zdt.getYear() / 100);
 bdt[3] = (byte) (zdt.getYear() % 100);
 bdt[4] = (byte) zdt.getHour();
 bdt[5] = (byte) zdt.getMinute();
 return CodecUtils.toHex(bdt);
}

代码示例来源:origin: infiniteautomation/ma-core-public

/**
  * @param runtime
  * @return
  */
 public static TimeValue get(ZonedDateTime runtime) {
   TimeValue value = new TimeValue();
   value.setHour(runtime.getHour());
   value.setMinute(runtime.getMinute());
   value.setSecond(runtime.getSecond());
   value.setMillisecond(runtime.getNano()/1000000);
   return value;
}

代码示例来源:origin: org.apache.tinkerpop/gremlin-core

@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final ZonedDateTime zonedDateTime) {
  output.writeInt(zonedDateTime.getYear());
  output.writeInt(zonedDateTime.getMonthValue());
  output.writeInt(zonedDateTime.getDayOfMonth());
  output.writeInt(zonedDateTime.getHour());
  output.writeInt(zonedDateTime.getMinute());
  output.writeInt(zonedDateTime.getSecond());
  output.writeInt(zonedDateTime.getNano());
  output.writeString(zonedDateTime.getZone().getId());
}

相关文章

ZonedDateTime类方法