PostgreSQL/Date Timezone/date trunc

Материал из SQL эксперт
Перейти к: навигация, поиск

date_trunc("hour", now())

   <source lang="sql">

postgres=# postgres=# SELECT date_trunc("hour", now());

      date_trunc

2006-10-08 15:00:00-07

(1 row) postgres=# postgres=#

      </source>
   
  


date_trunc("minute", now())

   <source lang="sql">

postgres=# SELECT date_trunc("minute", now());

      date_trunc

2006-10-08 15:12:00-07

(1 row) postgres=#

      </source>
   
  


date_trunc("year", now())

   <source lang="sql">

postgres=# postgres=# SELECT date_trunc("year", now());

      date_trunc

2006-01-01 00:00:00-08

(1 row) postgres=#

      </source>