TimestampConverter

The following provides usage information for the Apache Kafka® SMT org.apache.kafka.connect.transforms.TimestampConverter.

Description

Convert timestamps between different formats such as Unix epoch, strings, and Connect Date/Timestamp types. Applies to individual fields or to the entire value.

Use the concrete transformation type designed for the record key (org.apache.kafka.connect.transforms.TimestampConverter$Key) or value (org.apache.kafka.connect.transforms.TimestampConverter$Value).

Example

This configuration snippet shows how to use TimestampConverter to transform a Unix epoch (represented as an int64 value) into a formatted date string.

"transforms": "TimestampConverter",
"transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
"transforms.TimestampConverter.format": "yyyy-MM-dd"
"transforms.TimestampConverter.target.type": "string"

Before: 1556204536000

After: "2014-04-25"

Properties

Name Description Type Default Valid Values Importance
target.type The desired timestamp representation: string, unix, Date, Time, or Timestamp. string     high
field The field containing the timestamp, or empty if the entire value is a timestamp. string ""   high
format Format string for the timestamp that is compatible with java.text.SimpleDateFormat. Used to generate the output when type=string or used to parse the input if the input is a string. For additional details, see SimpleDateFormat. string ""   medium