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