Reputation: 31548
I have this query in mysql
SELECT *
FROM `calendar`
WHERE DATE_FORMAT(startTime, "%Y-%m-%d") = '2010-04-29'
How can i convert to Postgresql query?
Upvotes: 0
Views: 5895
Reputation: 263723
Basically, the query in MYSQL
which uses DATE_FORMAT()
converts date into string. If you want to compare it with date, don't use DATE_FORMAT()
but instead DATE()
. Try this, in PostgreSQL
, casting timestamp into date,
SELECT *
FROM "calendar"
WHERE "startTime"::date = '2010-04-29'
Upvotes: 4