Extract hour from date problems

It seems extract hour from date always return 0



current_date() only returns a date. If a date gets casted to a timestamp you will receive this:
select cast(current_date() as timestamp) → 2024-01-04 00:00:00.000

Instead of current_date(), you should use the now() function which is a timestamp and contains the time.

So this query would resolve your problem:
select hour(now())

1 Like

Thanks for your helping, obviously I misunderstood the date, Thanks again!