Remove TIMESTAMP precision from NOW() result in PostgreSQL?
datetime, postgresql, sql, timestamp
Solution
UPDATE tbl SET col = DATE_TRUNC('second', NOW());
See the docs for DATE_TRUNC.
Problem
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!