gpt4 book ai didi

io.debezium.time.ZonedTimestamp.toIsoString()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:01:31 29 4
gpt4 key购买 nike

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

ZonedTimestamp.toIsoString介绍

[英]Get the ISO 8601 formatted representation of the given java.time.LocalDateTime, java.time.LocalDate, java.time.LocalTime, java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp, OffsetTime, or OffsetDateTime, ignoring any date portions of the supplied value.
[中]获取给定java的ISO 8601格式表示。时间LocalDateTime,java。时间java的LocalDate。时间本地时间,java。util。日期,爪哇。sql。日期,爪哇。sql。时间,爪哇。sql。时间戳、OffsetTime或OffsetDateTime,忽略所提供值的任何日期部分。

代码示例

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

/**
 * Get the ISO 8601 formatted representation of the given {@link java.util.Date} or one of its JDBC subclasses, using
 * the supplied timezone information.
 * 
 * @param timestamp the timestamp value
 * @param zoneId the timezone identifier or offset where the timestamp is defined
 * @param adjuster the optional component that adjusts the local date value before obtaining the epoch day; may be null if no
 * adjustment is necessary
 * @return the ISO 8601 formatted string
 */
public static String toIsoString(java.util.Date timestamp, ZoneId zoneId, TemporalAdjuster adjuster) {
  if (timestamp instanceof java.sql.Timestamp) {
    return toIsoString((java.sql.Timestamp) timestamp, zoneId, adjuster);
  }
  if (timestamp instanceof java.sql.Date) {
    return toIsoString((java.sql.Date) timestamp, zoneId, adjuster);
  }
  if (timestamp instanceof java.sql.Time) {
    return toIsoString((java.sql.Time) timestamp, zoneId, adjuster);
  }
  return timestamp.toInstant().atZone(zoneId).format(FORMATTER);
}

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

return toIsoString((OffsetDateTime) value, adjuster);
return toIsoString((ZonedDateTime) value, adjuster);
return toIsoString((OffsetTime) value, adjuster);
return toIsoString((java.util.Date) value, defaultZone, adjuster);

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

/**
 * Converts a value object for an expected JDBC type of {@link Types#TIMESTAMP_WITH_TIMEZONE}.
 * The <a href="http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html">standard ANSI to Java 8 type
 * mappings</a> specify that the preferred mapping (when using JDBC's {@link java.sql.ResultSet#getObject(int) getObject(...)}
 * methods) in Java 8 is to return {@link OffsetDateTime} for these values.
 * <p>
 * This method handles several types of objects, including {@link OffsetDateTime}, {@link java.sql.Timestamp},
 * {@link java.util.Date}, {@link java.time.LocalTime}, and {@link java.time.LocalDateTime}.
 *
 * @param column the column definition describing the {@code data} value; never null
 * @param fieldDefn the field definition; never null
 * @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null
 * @return the converted value, or null if the conversion could not be made and the column allows nulls
 * @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
 */
protected Object convertTimestampWithZone(Column column, Field fieldDefn, Object data) {
  // epoch is the fallback value
  return convertValue(column, fieldDefn, data, OffsetDateTime.of(LocalDate.ofEpochDay(0), LocalTime.MIDNIGHT, defaultOffset), (r) -> {
    try {
      r.deliver(ZonedTimestamp.toIsoString(data, defaultOffset, adjuster));
    } catch (IllegalArgumentException e) {
    }
  });
}

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);
String isoString5 = ZonedTimestamp.toIsoString(t5, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaJ.defaultValue()).isEqualTo(
    MySQLConnection.forTestDatabase(DATABASE.getDatabaseName())

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

String isoStringA = ZonedTimestamp.toIsoString(a, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaA.defaultValue()).isEqualTo(isoStringA);

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

/**
 * Get the ISO 8601 formatted representation of the given {@link java.util.Date} or one of its JDBC subclasses, using
 * the supplied timezone information.
 * 
 * @param timestamp the timestamp value
 * @param zoneId the timezone identifier or offset where the timestamp is defined
 * @param adjuster the optional component that adjusts the local date value before obtaining the epoch day; may be null if no
 * adjustment is necessary
 * @return the ISO 8601 formatted string
 */
public static String toIsoString(java.util.Date timestamp, ZoneId zoneId, TemporalAdjuster adjuster) {
  if (timestamp instanceof java.sql.Timestamp) {
    return toIsoString((java.sql.Timestamp) timestamp, zoneId, adjuster);
  }
  if (timestamp instanceof java.sql.Date) {
    return toIsoString((java.sql.Date) timestamp, zoneId, adjuster);
  }
  if (timestamp instanceof java.sql.Time) {
    return toIsoString((java.sql.Time) timestamp, zoneId, adjuster);
  }
  return timestamp.toInstant().atZone(zoneId).format(FORMATTER);
}

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

return toIsoString((OffsetDateTime) value, adjuster);
return toIsoString((ZonedDateTime) value, adjuster);
return toIsoString((OffsetTime) value, adjuster);
return toIsoString((java.util.Date) value, defaultZone, adjuster);

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

/**
 * Converts a value object for an expected JDBC type of {@link Types#TIMESTAMP_WITH_TIMEZONE}.
 * The <a href="http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html">standard ANSI to Java 8 type
 * mappings</a> specify that the preferred mapping (when using JDBC's {@link java.sql.ResultSet#getObject(int) getObject(...)}
 * methods) in Java 8 is to return {@link OffsetDateTime} for these values.
 * <p>
 * This method handles several types of objects, including {@link OffsetDateTime}, {@link java.sql.Timestamp},
 * {@link java.util.Date}, {@link java.time.LocalTime}, and {@link java.time.LocalDateTime}.
 *
 * @param column the column definition describing the {@code data} value; never null
 * @param fieldDefn the field definition; never null
 * @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null
 * @return the converted value, or null if the conversion could not be made and the column allows nulls
 * @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
 */
protected Object convertTimestampWithZone(Column column, Field fieldDefn, Object data) {
  // epoch is the fallback value
  return convertValue(column, fieldDefn, data, OffsetDateTime.of(LocalDate.ofEpochDay(0), LocalTime.MIDNIGHT, defaultOffset), (r) -> {
    try {
      r.deliver(ZonedTimestamp.toIsoString(data, defaultOffset, adjuster));
    } catch (IllegalArgumentException e) {
    }
  });
}

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);

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

String isoString = ZonedTimestamp.toIsoString(t, ZoneId.systemDefault(), MySqlValueConverters::adjustTemporal);
assertThat(schemaB.defaultValue()).isEqualTo(isoString);
String isoString5 = ZonedTimestamp.toIsoString(t5, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaJ.defaultValue()).isEqualTo(
    MySQLConnection.forTestDatabase(DATABASE.getDatabaseName())

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

String isoStringA = ZonedTimestamp.toIsoString(a, ZoneOffset.UTC, MySqlValueConverters::adjustTemporal);
assertThat(schemaA.defaultValue()).isEqualTo(isoStringA);

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