79780375

Date: 2025-10-01 18:46:16
Score: 0.5
Natty:
Report link

According to the documentation, TO_TIMESTAMP_MS and TO_EPOCH_MS can be used together to get the previous hour's timestamp.

TO_TIMESTAMP_MS : Return the time point obtained by adding the value of argument "milliseconds" as millisecond, to the time point'1970-01-01T00:00:00.000Z'.

TO_EPOCH_MS : Return the lapsed time (in milliseconds) from the time '1970-01-01T00:00:00.000Z' to the time "timestamp".

Select query given below should return data for NOW() and the previous hour .

SELECT * FROM sensor_data WHERE row_key BETWEEN TO_TIMESTAMP_MS(TO_EPOCH_MS(NOW())-3600000) AND NOW();
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: iot_builder