开发者

Convert varchar to timestamp on PostgreSQL: ERROR: "TZ"/"tz" not supported

I have the following problem. I work on converting timestamps stored in a varchar column:

|    MyTimestamp               |
---------------------------------
|"Thu May 14 00:00:00 CEST 2009"|
|"Fri Aug 31 00:00:00 CEST 2007"|

with the to_timestamp function:

 select 
    to_timestamp(myTimestamp, 'Dy Mon DD HH24:MI:SS TZ YYYY'
 FROM 
    my_table

but I keep getting:

ERROR:  "TZ"/"tz" not supported

********** Error **********

ERROR: "TZ"/"tz" not supported
SQL state: 0A000

I wonder what I did wrong, is there a better way to convert a varchar to timestamp? Does not Postgre开发者_StackOverflow社区SQL support TZ/tz?


try this syntax:

SELECT 'Fri Aug 31 00:00:00 CEST 2007'::timestamp

this would be

SELECT myTimestamp::timestamp FROM my_table
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜