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

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

          ZonedDateTime zonedDateTime = null;

          // java.time.LocalDateTime is used when reading CDC data via connector
          if (input instanceof LocalDateTime) {
            zonedDateTime = ((LocalDateTime) input).atZone(timestampZoneId);

          }
          // java.sql.Timestamp is used during Debezium snapshots
          else if (input instanceof Timestamp) {
              zonedDateTime = ((Timestamp) input).toLocalDateTime().atZone(timestampZoneId);
          }

          if (zonedDateTime != null) {
            logger.debug("convertDateTime: {} -> {}", zonedDateTime, zonedDateTime.toInstant().toEpochMilli());

            return zonedDateTime.toInstant().toEpochMilli();
          }
        }

        return null;
    }
/**
     * Datetimes are converted to UTC when ingested thereby advancing the time by
     * the GMT offset.
     * These can be converted to the local timezone (passed to this converter) to
     * return to the original
     * time in the source DB. To maintain consistency with the Debezium timestamp
     * schema, these are
     * returned as an Epoch in milliseconds.
     *
     * @param input
     * @return
     */
Datetimes are converted to UTC when ingested thereby advancing the time by
the GMT offset.
These can be converted to the local timezone (passed to this converter) to
return to the original
time in the source DB. To maintain consistency with the Debezium timestamp
schema, these are
returned as an Epoch in milliseconds.

@param input
@return
Datetimes are converted to UTC when ingested thereby advancing the time by the GMT offset . These can be converted to the local timezone ( passed to this converter ) to return to the original time in the source DB . To maintain consistency with the Debezium timestamp schema these are returned as an Epoch in milliseconds . @param input @return
private Long convertDateTime(Object input) {
        logger.debug("DATETIME value: {}", input);
        if (input != null) {
          logger.debug("DATETIME value is instance of: {}", input.getClass());
          ZonedDateTime zonedDateTime = null;
          if (input instanceof LocalDateTime) {
            zonedDateTime = ((LocalDateTime) input).atZone(timestampZoneId);
          }
          else if (input instanceof Timestamp) {
              zonedDateTime = ((Timestamp) input).toLocalDateTime().atZone(timestampZoneId);
          }
          if (zonedDateTime != null) {
            logger.debug("convertDateTime: {} -> {}", zonedDateTime, zonedDateTime.toInstant().toEpochMilli());
            return zonedDateTime.toInstant().toEpochMilli();
          }
        }
        return null;
    }
private Long convertDateTime ( Object input ) { logger . debug ( "DATETIME value: {}" , input ) ; if ( input != null ) { logger . debug ( "DATETIME value is instance of: {}" , input . getClass ( ) ) ; ZonedDateTime zonedDateTime = null ; if ( input instanceof LocalDateTime ) { zonedDateTime = ( ( LocalDateTime ) input ) . atZone ( timestampZoneId ) ; } else if ( input instanceof Timestamp ) { zonedDateTime = ( ( Timestamp ) input ) . toLocalDateTime ( ) . atZone ( timestampZoneId ) ; } if ( zonedDateTime != null ) { logger . debug ( "convertDateTime: {} -> {}" , zonedDateTime , zonedDateTime . toInstant ( ) . toEpochMilli ( ) ) ; return zonedDateTime . toInstant ( ) . toEpochMilli ( ) ; } } return null ; }
Datetimes are converted to UTC when ingested thereby advancing the time by
 the GMT offset.
Datetimes are converted to UTC when ingested thereby advancing the time by the GMT offset .
// java.time.LocalDateTime is used when reading CDC data via connector // java.sql.Timestamp is used during Debezium snapshots