如何在 PostgreSQL 中获取日期的开始时间?

How to get the start time of a date in PostgreSQL?

如何在 PostgreSQL 中获取日期的开始时间? ex- 从“2013-07-15 10:10:00”得到“2013-07-15 00:00:00”

使用date_trunc,例如:

psql=> SELECT date_trunc('day',now());
       date_trunc
------------------------
 2016-10-07 00:00:00+11
(1 row)

参见:date_trunc