Hello friends, I have a timestamp in zulu format (...
# troubleshooting
d
Hello friends, I have a timestamp in zulu format (e.g.
2023-04-05T11:40:00Z
) stored as a STRING column and I tried casting it to TIMESTAMP type with: •
TO_TIMESTAMP(<col_name>, '%Y-%m-%dT%H:%M:%SZ')
•
TO_TIMESTAMP(<col_name>, 'yyyy-MM-ddTHH:mm:ssZ')
but both result in NULL values. What am I missing?
j
Hi mate 👋, This should solve your problem (context: reading Kafka topic in JSON format with Flink SQL):
Copy code
Table definition (I put only configuration properties that are relevant for your case):

CREATE TABLE DummyTable (
 ts_field TIMESTAMP_LTZ(3)
) WITH (
 'connector' = 'kafka',
 'format' = 'json',
 'json.timestamp-format.standard' = 'ISO-8601'
)

---------------

Validation:

SELECT ts_field, 
  HOUR(ts_field), 
  MINUTE(ts_field) 
FROM DummyTable
✅ 1
❤️ 1