PostgreSQL/Date Timezone/date trunc
Версия от 13:45, 26 мая 2010; (обсуждение)
date_trunc("hour", now())
postgres=#
postgres=# SELECT date_trunc("hour", now());
date_trunc
------------------------
2006-10-08 15:00:00-07
(1 row)
postgres=#
postgres=#
date_trunc("minute", now())
postgres=# SELECT date_trunc("minute", now());
date_trunc
------------------------
2006-10-08 15:12:00-07
(1 row)
postgres=#
date_trunc("year", now())
postgres=#
postgres=# SELECT date_trunc("year", now());
date_trunc
------------------------
2006-01-01 00:00:00-08
(1 row)
postgres=#