src/main/java/com/itcig/debezium/converter/MySqlDateTimeConverter.java
private String convertTimestamp(Object input) {
        logger.debug("TIMESTAMP value: {}", input);

        if (input != null) {
          logger.debug("TIMESTAMP value is instance of: {}", input.getClass());

          Instant timestampInstant = null;

          // java.time.ZonedDateTime is used when reading CDC data via connector
          if(input instanceof ZonedDateTime) {
            timestampInstant = ((ZonedDateTime) input).toInstant();
          }
          // java.sql.Timestamp is used during Debezium snapshots
          else if (input instanceof Timestamp) {
            timestampInstant = ((Timestamp) input).toInstant();
          }

          if (timestampInstant != null) {
            logger.debug("convertTimestamp: Instant {}", timestampInstant.toString());

            return timestampInstant.toString();
          }
        }

        return null;
    }
/**
     * Timestamps are already converted to UTC based on the connector/server
     * timezone offset.
     * So they only need to be converted to ISO format with no GMT offset.
     *
     * @param input
     * @return
     */
Timestamps are already converted to UTC based on the connector/server
timezone offset.
So they only need to be converted to ISO format with no GMT offset.

@param input
@return
Timestamps are already converted to UTC based on the connector / server timezone offset . So they only need to be converted to ISO format with no GMT offset . @param input @return
private String convertTimestamp(Object input) {
        logger.debug("TIMESTAMP value: {}", input);
        if (input != null) {
          logger.debug("TIMESTAMP value is instance of: {}", input.getClass());
          Instant timestampInstant = null;
          if(input instanceof ZonedDateTime) {
            timestampInstant = ((ZonedDateTime) input).toInstant();
          }
          else if (input instanceof Timestamp) {
            timestampInstant = ((Timestamp) input).toInstant();
          }
          if (timestampInstant != null) {
            logger.debug("convertTimestamp: Instant {}", timestampInstant.toString());
            return timestampInstant.toString();
          }
        }
        return null;
    }
private String convertTimestamp ( Object input ) { logger . debug ( "TIMESTAMP value: {}" , input ) ; if ( input != null ) { logger . debug ( "TIMESTAMP value is instance of: {}" , input . getClass ( ) ) ; Instant timestampInstant = null ; if ( input instanceof ZonedDateTime ) { timestampInstant = ( ( ZonedDateTime ) input ) . toInstant ( ) ; } else if ( input instanceof Timestamp ) { timestampInstant = ( ( Timestamp ) input ) . toInstant ( ) ; } if ( timestampInstant != null ) { logger . debug ( "convertTimestamp: Instant {}" , timestampInstant . toString ( ) ) ; return timestampInstant . toString ( ) ; } } return null ; }
Timestamps are already converted to UTC based on the connector/server
 timezone offset.
Timestamps are already converted to UTC based on the connector / server timezone offset .
// java.time.ZonedDateTime is used when reading CDC data via connector // java.sql.Timestamp is used during Debezium snapshots