How to convert column type from varchar to date in PostgreSQL?

前端 未结 4 1232
盖世英雄少女心
盖世英雄少女心 2020-12-30 03:21

I have varchar data type column and date data type column.

I have to update varchar column data into date column

4条回答
  •  星月不相逢
    2020-12-30 04:01

    UPDATE tableName SET dateColumn=to_date(varcharColumn, 'DD MM YYYY')
    

    Assuming you are saving "07 04 2010"

    You can find further examples and explanation in the documentation:

    http://www.postgresql.org/docs/current/interactive/functions-formatting.html

提交回复
热议问题