转换日期postgreSQL时出错

时间:2014-04-27 20:55:52

标签: sql postgresql casting

我正在尝试使用以下代码将varchar转换为日期,并输出以下错误,任何想法为什么?

ALTER TABLE import.employee
ALTER COLUMN birth_date
TYPE date
USING (birth_date::date);

    ERROR:  date/time field value out of range: "05/29/1960"
HINT:  Perhaps you need a different "datestyle" setting.
********** Error **********

ERROR: date/time field value out of range: "05/29/1960"
SQL state: 22008
Hint: Perhaps you need a different "datestyle" setting.

1 个答案:

答案 0 :(得分:2)

如果您需要从birth_date获取:: date,请先使用Data Type Formatting Functions文档中的给定函数将DATE格式提供给您的字段。