almoujtahed
almoujtahed

Reputation: 165

PostgreSQL timestamp select

I'm using Posture and I got error message "invalid input syntax for type timestamp with time zone" when using the following select code:

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')**

While registrationTimestamp timestamp format is like following:

6/26/2012  6:43:10 PM

Upvotes: 2

Views: 1538

Answers (1)

Pavel Stehule
Pavel Stehule

Reputation: 45950

There is wrong using of apostrophes

Should be

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')

Upvotes: 1

Related Questions