Home > database >  How to get the yyyyDDmm000 date format in impala shell?
How to get the yyyyDDmm000 date format in impala shell?

Time:11-25

I want to use the yyyyDDmm000 date format in impala-shell.
Example: 20221122000

I have used the below query.
select from_timestamp(date_sub(now(), 1), 'yyyyMMdd');
And the result was 20221121.
And When I used the below query I got WARNINGS: Bad date/time conversion format: yyyyMMdd000.
select from_timestamp(date_sub(now(), 1), 'yyyyMMdd000');
How can we achieve this format?

CodePudding user response:

I got the desired output.
I have used below query to get this date format.
select CAST(concat(from_timestamp((now()-interval 1 day), 'yyyyMMdd'),'000') AS BIGINT);

  • Related