Home > database >  PostgreSQL unified annual change date fields, such as unified to 2019
PostgreSQL unified annual change date fields, such as unified to 2019

Time:10-10

Update table name set date field name=to_timestamp (' 2019 '| |' - '| | to_char (date field name, "mm") | |' - 'to_char (date field name, the' dd '), '- dd YYYY - mm);

CodePudding user response:

https://blog.csdn.net/camillect/article/details/85069025

 
The UPDATE table_name
The SET date_col=to_date (
CONCAT (
'2018',
RIGHT (
To_char (date_col, '- dd yyyy - mm),
6
)
),
'- dd yyyy - mm'
);


 
The UPDATE table_name SET time_col=to_timestamp (CONCAT (
'2018',
RIGHT (
To_char (time_col, 'yyyy - mm - dd HH24: MI: SS'),
15
)
), '- dd yyyy - mm HH24: MI: SS')
  • Related