Sql – Remove TIMESTAMP precision from NOW() result in PostgreSQL

datetimepostgresqlsqltimestamp

Is there any way to remove the precision from the result of the NOW() function in PostgreSQL?

"2012-08-21 10:23:34.867502"

I'm looking for the format to be:

"2012-08-21 10:23:34"

I'm attempting to update a column of type "timestamp without time zone" with the following SQL:

UPDATE table SET column = now();

Thanks!

Best Answer

Simple answer is to cast it to zero precision.

select now()::timestamptz(0);