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

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

本文整理了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

  1. /**
  2. * Returns true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false
  3. * otherwise.
  4. *
  5. * @param actual the actual OffsetDateTime. expected not be null
  6. * @param other the other OffsetDateTime. expected not be null
  7. * @return true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false
  8. * otherwise.
  9. */
  10. private static boolean areEqualIgnoringNanos(OffsetDateTime actual, OffsetDateTime other) {
  11. return areEqualIgnoringSeconds(actual, other) && actual.getSecond() == other.getSecond();
  12. }

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

  1. /**
  2. * Returns true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false
  3. * otherwise.
  4. *
  5. * @param actual the actual OffsetDateTime. expected not be null
  6. * @param other the other OffsetDateTime. expected not be null
  7. * @return true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false
  8. * otherwise.
  9. */
  10. private static boolean areEqualIgnoringNanos(OffsetDateTime actual, OffsetDateTime other) {
  11. return areEqualIgnoringSeconds(actual, other) && actual.getSecond() == other.getSecond();
  12. }

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

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

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

  1. @Override
  2. public void serialize(OffsetDateTime instant, JsonGenerator generator, SerializerProvider provider)
  3. throws IOException {
  4. StringBuilder builder = new StringBuilder();
  5. builder.append(instant.toLocalDateTime().toString());
  6. if (instant.getSecond() == 0 && instant.getNano() == 0) {
  7. builder.append(":00");
  8. }
  9. builder.append(instant.getOffset().toString());
  10. generator.writeString(builder.toString());
  11. }
  12. }

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

  1. /**
  2. * Creates a new Carbon instance from the provided offset date time object.
  3. *
  4. * @param offsetDateTime The offset date time that the Carbon instance should be created from.
  5. * @return a Carbon instance with the provided date and time.
  6. */
  7. public static Carbon createFromOffsetDateTime(OffsetDateTime offsetDateTime) {
  8. return Carbon.create(
  9. offsetDateTime.getYear(),
  10. offsetDateTime.getMonthValue(),
  11. offsetDateTime.getDayOfMonth(),
  12. offsetDateTime.getHour(),
  13. offsetDateTime.getMinute(),
  14. offsetDateTime.getSecond()
  15. );
  16. }

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

  1. @Override
  2. public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
  3. super.serialize(writer, datetime);
  4. OutputStream stream = writer.stream;
  5. if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
  6. stream.write(TagString);
  7. ValueWriter.write(stream, datetime.toString());
  8. }
  9. else {
  10. int year = datetime.getYear();
  11. if (year > 9999 || year < 1) {
  12. stream.write(TagString);
  13. ValueWriter.write(stream, datetime.toString());
  14. }
  15. else {
  16. ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
  17. ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
  18. ValueWriter.writeNano(stream, datetime.getNano());
  19. stream.write(TagUTC);
  20. }
  21. }
  22. }
  23. }

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

  1. /**
  2. * Creates a date value.
  3. *
  4. * @param date The date value.
  5. */
  6. private Value(OffsetDateTime date) {
  7. XMLGregorianCalendar xmlGregorianCalendar;
  8. try {
  9. xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
  10. xmlGregorianCalendar.setYear(date.getYear());
  11. xmlGregorianCalendar.setMonth(date.getMonth().getValue());
  12. xmlGregorianCalendar.setDay(date.getDayOfMonth());
  13. xmlGregorianCalendar.setTime(date.getHour(), date.getMinute(), date.getSecond()); // date.get(ChronoField.MILLI_OF_SECOND)
  14. xmlGregorianCalendar.setTimezone(date.getOffset().getTotalSeconds() / 60);
  15. } catch (DatatypeConfigurationException e) {
  16. xmlGregorianCalendar = null;
  17. }
  18. this.value = xmlGregorianCalendar;
  19. }

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

  1. @Override
  2. public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
  3. super.serialize(writer, datetime);
  4. OutputStream stream = writer.stream;
  5. if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
  6. stream.write(TagString);
  7. ValueWriter.write(stream, datetime.toString());
  8. }
  9. else {
  10. int year = datetime.getYear();
  11. if (year > 9999 || year < 1) {
  12. stream.write(TagString);
  13. ValueWriter.write(stream, datetime.toString());
  14. }
  15. else {
  16. ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
  17. ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
  18. ValueWriter.writeNano(stream, datetime.getNano());
  19. stream.write(TagUTC);
  20. }
  21. }
  22. }
  23. }

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

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

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

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

相关文章