Reputation: 2491
I am trying to extract the time part only (excluding milliseconds) from the date-time string in amazon redshift.
I used:
Select now()::time;
But it is giving me error.
Error running query: Specified types or functions (one per INFO message) not supported on Redshift tables
.
Any help would be highly appreciated.
Upvotes: 2
Views: 10601
Reputation: 564
I can't find now()
in RedShift documentation although selecting now() works. Instead, RedShift offers
select getdate()
(docs) which gives you the recent date.
Upvotes: 0
Reputation: 51
Use below select clause returning the exact required result for time
Select CURRENT_TIME::time(0);
Upvotes: 1
Reputation: 5729
I'm less sure about the error, but I agree with Jon Scott's comment, the following query runs fine without any error.
Select now()::time;
It outputs something like:
09:23:49.697401
It contains time with 6 digits after seconds.
If you just add time parameter up to, how many digits your need after seconds like below. Here its 0
.
Select now()::time(0);
This will output:
09:23:49
If you do;
Select now()::time(1);
This will output:
09:23:49.6
Hope it answers your question.
Upvotes: 3