date_trunc ( text, timestamp ) → timestamp → timestampTruncate to specified precision; see Section 9.9.2
date_trunc
Truncate to specified precision; see Section 9.9.2
English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- group
- datetime
- group label
- 时间/日期函数和操作符
- lang
- en
- layout
- table-new
- pages
- functions-datetime.html
- prose only
- false
Definition PG 18
Truncate to specified precision; see Section 9.9.2
Signatures and overloads
date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone → timestamp with time zoneTruncate to specified precision in the specified time zone; see Section 9.9.2
date_trunc ( text, interval ) → interval → intervalTruncate to specified precision; see Section 9.9.2
date_trunc(field, source [, time_zone])
source is a value expression of type timestamp, timestamp with time zone, or interval. (Values of type date and time are cast automatically to timestamp or interval, respectively.) field selects to which precision to truncate the input value. The return value is likewise of type timestamp, timestamp with time zone, or interval, and it has all fields that are less significant than the selected one set to zero (or one, for day and month).Compare versions
Complete source facts
documentation revision
{"inputs":[{"file":"functions-datetime.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"8c5053713aeaacfbe4cb00effc61f10d457c98b2a29c724b10b93819a087ea95","version":"18.7"},{"file":"functions-datetime.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"c3efdd1c3df6795c73dfea2ecec17ca31ff37da23d758083a581d75445851f0c","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff
Text language: en · wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff