0

I have a table which has 'completed' column with the timestamp but the timestamp is in epoch format. I am using the below query to translate the epoch time to a normal date but I am not sure how to filter the records that were created today. Hope someone can assist.

Here is the query I am using:

select name, status, message, completion_status, 
TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * completed AS TIMESTAMP), 'America/New_York'), 'yyyy-mm-dd HH24:MI:SS') 
as completed from Result;

Sriram Kumar
  • 69
  • 2
  • 6

1 Answers1

0

Found it:

select name, status, message, completion_status, 
TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * completed AS TIMESTAMP), 'America/New_York'), 'yyyy-mm-dd HH24:MI:SS') 
as completed from Result
where TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * completed AS TIMESTAMP), 'America/New_York'), 'yyyy-mm-dd') 
LIKE (SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD') as today_date FROM dual);
Sriram Kumar
  • 69
  • 2
  • 6