How can I discard/round the millisecond part, better if the second part is also removed from a timestamp w/o timezone ?
millisecond
second
timestamp
timezone
A cast to timestamp(0) or timestamptz(0) rounds to full seconds:
timestamp(0)
timestamptz(0)
SELECT now()::timestamp(0);
Fractions are not stored in table columns of this type.
date_trunc() truncates (leaves seconds unchanged) - which is often what you really want:
date_trunc()
SELECT date_trunc('second', now()::timestamp);
1.4m articles
1.4m replys
5 comments
57.0k users