Skip to content

Postgresql time

sql
# compare time
xxxx > CURRENT_DATE

# timestamptz to 'datetime'
table_name."time"::timestamp without time zone::date

# timestamptz to `date with hour`
to_char(date_trunc('hour'::text, table_name."time"::timestamp without time zone), 'YYYY-MM-DD HH24:00'::text) AS hour

Released under the MIT License.