Click to copy
Working With Dates • Reviewed for ksqlDB 0.29
How to Get Record Timestamp in ksqlDB
Use the pseudo-column ROWTIME to get the record timestamp in milliseconds since
EPOCH
:
SELECT
flight_id,
ROWTIME,
FROM_UNIXTIME(ROWTIME) as ROWTIME_TS
FROM flights
LIMIT 1;
that returns :
+-------------------------+-------------------------+-------------------------+
|ROWTIME |ROWTIME_TS |FLIGHT_ID |
+-------------------------+-------------------------+-------------------------+
|1657876520019 |2022-07-15T09:15:20.019 |373780 |
ROWTIMEis of typeBIGINT, so remember that you can use the functionFROM_UNIXTIMEto convert it to theTIMESTAMPtype. Then useFORMAT_TIMESTAMPif you need a particular timestamp format.
Was this article helpful?