athena query question

0

Hi I have a table in Athena with an attached screenshot.

How i can list all entries in between two days using timestamp column as referenceEnter image description here

질문됨 일 년 전755회 조회
2개 답변
3

You can convert bigint to date timestamp as below:

           date_format(from_unixtime(bigint_timestamp_column/1000),’%Y-%m-%d %h:%i%p')

You can test this by running this sample:

           select date_format(from_unixtime(1688183062393/1000), '%Y-%m-%d %h:%i:%s')

Here is how you'd query your table with condition:

          select * from table_name where date_format(from_unixtime(1688183062393/1000), '%Y-%m-%d %h:%i:%s') > date_parse('2023-07-01', '%Y-%m-%d') and date_format(from_unixtime(1688183062393/1000), '%Y-%m-%d %h:%i:%s') < date_parse('2023-07-10', '%Y-%m-%d')

Hope you find this helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
전문가
답변함 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
  • Were you able to use this method in your use case, comment here if you have any additional questions?

  • Thanks for the answer. I tried this earlier and didn’t helped me . What I did is changed columns type and then looked for what I need in the table.

0

Select DATE_FORMAT(timestamp,'%Y-%m-%d') where timestamp >= timestamp '2023-08-30' and timestamp <= timestamp '2023-09-01'

profile pictureAWS
전문가
답변함 일 년 전
  • Thanks for your answer. This was one of my first tries and didn’t helped.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠