Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Kafka consumer connector time_of_event_field and date_format value with epoch time

erlfos
Giga Expert

Hi

We have a Kafka connector instance which is collecting events from a Kafka topic. It is possible to set the time_of_event_field from a field in the Kafka payload, and we have a field we would like to use (timestamp_kafka). The problem is that the timestamp is in epoch time format with milliseconds (i.e 1700216358002) and the documentation (https://docs.servicenow.com/csh?topicname=configure-kafka-consumer-connector.html&version=latest) does not say how I can set the date_format field to make ServiceNow understand the format in the time_of_event_field when the timestamp is in epoch time.

Does anyone know?

1 REPLY 1

erlfos
Giga Expert

After digging into the Kafka connector Javascript code I found out that the Kafka connector use the Java class SimpleDateFormat (https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) to parse the time_of_event_field. It looks like the class is unable to parse epoch time. It is strange to think that epoch time is not supported in the time_of_event_field.