Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在mysql中有这个查询
SELECT * FROM `calendar` WHERE DATE_FORMAT(startTime, "%Y-%m-%d") = '2010-04-29'
如何转换为 Postgresql 查询?
基本上,MYSQL其中使用的查询DATE_FORMAT()将日期转换为字符串。如果要将其与日期进行比较,请不要使用DATE_FORMAT()but DATE()。试试这个,在PostgreSQL,将时间戳转换为日期,
MYSQL
DATE_FORMAT()
DATE()
PostgreSQL
SELECT * FROM "calendar" WHERE "startTime"::date = '2010-04-29'
SELECT * FROM calendar WHERE starttime::date = '2010-04-29'