java.time.OffsetDateTime.getSecond()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(105)

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

OffsetDateTime.getSecond介绍

[英]Gets the second-of-minute field.
[中]获取“秒”字段。

代码示例

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

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

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

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

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

assertThat(c4DateTime.getSecond()).isEqualTo(0);
  assertThat(c4DateTime.getNano()).isEqualTo(0);
} else if (record.topic().endsWith("dbz_123_bitvaluetest")) {

代码示例来源:origin: openmhealth/schemas

@Override
  public void serialize(OffsetDateTime instant, JsonGenerator generator, SerializerProvider provider)
      throws IOException {

    StringBuilder builder = new StringBuilder();

    builder.append(instant.toLocalDateTime().toString());

    if (instant.getSecond() == 0 && instant.getNano() == 0) {
      builder.append(":00");
    }

    builder.append(instant.getOffset().toString());

    generator.writeString(builder.toString());
  }
}

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

/**
 * Creates a new Carbon instance from the provided offset date time object.
 *
 * @param offsetDateTime The offset date time that the Carbon instance should be created from.
 * @return a Carbon instance with the provided date and time.
 */
public static Carbon createFromOffsetDateTime(OffsetDateTime offsetDateTime) {
  return Carbon.create(
    offsetDateTime.getYear(),
    offsetDateTime.getMonthValue(),
    offsetDateTime.getDayOfMonth(),
    offsetDateTime.getHour(),
    offsetDateTime.getMinute(),
    offsetDateTime.getSecond()
  );
}

代码示例来源:origin: hprose/hprose-java

@Override
  public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
    super.serialize(writer, datetime);
    OutputStream stream = writer.stream;
    if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
      stream.write(TagString);
      ValueWriter.write(stream, datetime.toString());
    }
    else {
      int year = datetime.getYear();
      if (year > 9999 || year < 1) {
        stream.write(TagString);
        ValueWriter.write(stream, datetime.toString());
      }
      else {
        ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
        ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
        ValueWriter.writeNano(stream, datetime.getNano());
        stream.write(TagUTC);
      }
    }
  }
}

代码示例来源:origin: rocks.xmpp/xmpp-extensions-common

/**
 * Creates a date value.
 *
 * @param date The date value.
 */
private Value(OffsetDateTime date) {
  XMLGregorianCalendar xmlGregorianCalendar;
  try {
    xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
    xmlGregorianCalendar.setYear(date.getYear());
    xmlGregorianCalendar.setMonth(date.getMonth().getValue());
    xmlGregorianCalendar.setDay(date.getDayOfMonth());
    xmlGregorianCalendar.setTime(date.getHour(), date.getMinute(), date.getSecond()); // date.get(ChronoField.MILLI_OF_SECOND)
    xmlGregorianCalendar.setTimezone(date.getOffset().getTotalSeconds() / 60);
  } catch (DatatypeConfigurationException e) {
    xmlGregorianCalendar = null;
  }
  this.value = xmlGregorianCalendar;
}

代码示例来源:origin: org.hprose/hprose-java

@Override
  public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
    super.serialize(writer, datetime);
    OutputStream stream = writer.stream;
    if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
      stream.write(TagString);
      ValueWriter.write(stream, datetime.toString());
    }
    else {
      int year = datetime.getYear();
      if (year > 9999 || year < 1) {
        stream.write(TagString);
        ValueWriter.write(stream, datetime.toString());
      }
      else {
        ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
        ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
        ValueWriter.writeNano(stream, datetime.getNano());
        stream.write(TagUTC);
      }
    }
  }
}

代码示例来源:origin: ngs-doo/dsl-json

NumberConverter.write2(value.getMinute(), buf, pos + 15);
buf[pos + 17] = ':';
NumberConverter.write2(value.getSecond(), buf, pos + 18);
final int nano = value.getNano();
if (nano != 0) {

代码示例来源:origin: io.debezium/debezium-connector-mysql

assertThat(c4DateTime.getSecond()).isEqualTo(0);
  assertThat(c4DateTime.getNano()).isEqualTo(0);
} else if (record.topic().endsWith("dbz_123_bitvaluetest")) {

相关文章