我想把一列数据从文本改成时间戳类型.我的数据中没有时区.我的数据格式是28-03-17 17:22,包括时间和日期,但没有时区.换句话说,我所有的数据都在同一个时区.我该怎么做?
我在下面try 了多种方法,但仍然找不到正确的方法.希望你能帮助我.
当然,如果我的问题得到解决,我可以建一张新桌子.
alter table AB
alter create_time type TIMESTAMP;
ERROR: column "create_time" cannot be cast automatically to type timestamp without time zone
HINT: You might need to specify "USING create_time::timestamp without time zone".
********** Error **********
ERROR: column "create_time" cannot be cast automatically to type timestamp without time zone
SQL state: 42804
Hint: You might need to specify "USING create_time::timestamp without time zone".
alter table AB
alter create_time type TIMESTAMP without time zone;
ERROR: column "create_time" cannot be cast automatically to type timestamp without time zone
HINT: You might need to specify "USING create_time::timestamp without time zone".
********** Error **********
ERROR: column "create_time" cannot be cast automatically to type timestamp without time zone
SQL state: 42804
Hint: You might need to specify "USING create_time::timestamp without time zone".
alter table AB
alter create_time::without time zone type TIMESTAMP;
ERROR: syntax error at or near "::"
LINE 2: alter create_time::without time zone type TIMESTAM
^
********** Error **********
ERROR: syntax error at or near "::"
SQL state: 42601
Character: 50
alter table AB
alter create_time UTC type TIMESTAMP;
ERROR: syntax error at or near "UTC"
LINE 2: alter create_time UTC type TIMESTAMP;
^
********** Error **********
ERROR: syntax error at or near "UTC"
SQL state: 42601
Character: 50