PostgreSQL时间戳选择

时间:2013-10-30 11:55:54

标签: postgresql

我正在使用Posture,当使用以下选择代码时,我收到错误消息“带时区的类型时间戳的输入语法无效”:

SELECT * FROM public."table1" WHERE 'registrationTimestamp' BETWEEN 
to_timestamp('22-10-2013 00:00', 'DD-MM-YYYY HH24:MI')
AND to_timestamp('22-10-2013 23:59', 'DD-MM-YYYY HH24:MI')**

虽然registrationTimestamp时间戳格式如下:

6/26/2012  6:43:10 PM

1 个答案:

答案 0 :(得分:0)

使用撇号有错误

应该是

SELECT * FROM public."table1" 
 WHERE "registrationTimestamp" BETWEEN 
            to_timestamp('22-10-2013 00:00', 'DD-MM-YYYY HH24:MI')
        AND to_timestamp('22-10-2013 23:59', 'DD-MM-YYYY HH24:MI')