Postgres: Update date and retain time from timestamp

There's another way, using the DateTime type.

So if you want to set a table's Date to today, you can use this:

UPDATE table SET column = current_date::date + column::time;

Switch current_date with "2019-02-23" and it should work as well.


Try this:

UPDATE mytable 
SET field1 = '2015-12-31'::timestamp + 
             EXTRACT(HOUR FROM field1) * INTERVAL '1 HOUR' +
             EXTRACT(MINUTE FROM field1) * INTERVAL '1 MINUTE' +
             EXTRACT(SECOND FROM field1) * INTERVAL '1 SECOND' 
WHERE ...

Demo here