{"Entry":{"collection":"func","key":"date-trunc","name":"date_trunc","aliases":[],"metadata":{"changed_in":["9.4","12","18"],"changes":[{"descriptions_changed":true,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.3"},{"descriptions_changed":true,"doc_overhaul":false,"from":"7.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"7.4","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"8.0"},{"descriptions_changed":false,"doc_overhaul":false,"from":"9.3","group_changed":null,"signatures":{"added":["date_trunc ( text, interval ) → interval"],"removed":[]},"status":"changed","to":"9.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"11","group_changed":null,"signatures":{"added":["date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone","date_trunc(field, source [, time_zone ])"],"removed":["date_trunc('field', source)"]},"status":"changed","to":"12"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":false,"doc_overhaul":false,"from":"17","group_changed":null,"signatures":{"added":["date_trunc(field, source [, time_zone])"],"removed":["date_trunc(field, source [, time_zone ])"]},"status":"changed","to":"18"}],"content_hash":"abe4b7a175d2444927ab6404d3cef4c40ccaf0165a28414a037e838408acc5f2","derived_content_hash":"cb642d012fab934d7f8c5c9c9b4ef7cf69e3c8d31e3a093c54ef6f54a3104925","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"7.1","group":"datetime","group_label":"Date/Time Functions And Operators","groups":["datetime"],"imported_at":"2026-09-27T17:57:28.529196+08:00","last_version":"20","name":"date_trunc","name_key":"date_trunc","position":8009,"present_in":["7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:915992acfe3124c73dfdaaf717a3a7b4b3e53d5e03e64c6ca5a90316e81fa8c2","receipt_sha256":"e800e4b68d0f5e7f3c77373a332354c66c8c28652bd464e9b06456cb2a2fd77a","repair":"wiki-repair-20261023"},"signature":"date_trunc ( text, timestamp ) → timestamp","signature_count":4,"slug":"date-trunc","source_rev":"wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff","summary":"Truncate to specified precision; see Section 9.9.2","summary_zh":""}},"Definition":{"Collection":"func","Key":"date-trunc","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"date-trunc","SourceRevision":"wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff","Facts":{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","doc":{"anchor":"FUNCTIONS-DATETIME-TABLE","file":"functions-datetime.html","sha256":"8c5053713aeaacfbe4cb00effc61f10d457c98b2a29c724b10b93819a087ea95","slug":"18"},"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"},"group":"datetime","group_label":"时间/日期函数和操作符","lang":"en","layout":"table-new","pages":["functions-datetime.html"],"prose_only":false,"signatures":[{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', timestamp '2001-02-16 20:38:40')","result":"2001-02-16 20:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp\u003c/code\u003e","returns":"timestamp","text":"date_trunc ( text, timestamp ) → timestamp","zh_from":"same-version-manual"},{"description":"Truncate to specified precision in the specified time zone; see Section 9.9.2","description_html":"Truncate to specified precision in the specified time zone; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"在规定的时区中截断到指定的精度；参见第 9.9.2 节","description_zh_html":"在规定的时区中截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')","result":"2001-02-16 13:00:00+00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp with time zone\u003c/code\u003e","returns":"timestamp with time zone","text":"date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone","zh_from":"same-version-manual"},{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', interval '2 days 3 hours 40 minutes')","result":"2 days 03:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einterval\u003c/code\u003e","returns":"interval","text":"date_trunc ( text, interval ) → interval","zh_from":"same-version-manual"},{"description":"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).","description_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e is a value expression of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e. (Values of type \u003ccode class=\"type\"\u003edate\u003c/code\u003e and \u003ccode class=\"type\"\u003etime\u003c/code\u003e are cast automatically to \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, respectively.) \u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e selects to which precision to truncate the input value. The return value is likewise of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, and it has all fields that are less significant than the selected one set to zero (or one, for day and month).","description_zh":"source 是 timestamp、timestamp with time zone 或 interval 类型的值表达式。（date 和 time 类型的值会分别自动转换为 timestamp 或 interval。）field 选择输入值的截断精度。返回值同样为 timestamp、timestamp with time zone 或 interval 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","description_zh_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e 是 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型的值表达式。（\u003ccode class=\"type\"\u003edate\u003c/code\u003e 和 \u003ccode class=\"type\"\u003etime\u003c/code\u003e 类型的值会分别自动转换为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e。）\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e 选择输入值的截断精度。返回值同样为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","examples":[],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003etime_zone\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e])","returns":"","text":"date_trunc(field, source [, time_zone])","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-datetime.html","sha256":"2340eed8f18e5a5a727bb6bf8f828eedbab527da91082a214ea4f64a3b8750a6"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-DATETIME-TABLE","file":"functions-datetime.html","sha256":"8c5053713aeaacfbe4cb00effc61f10d457c98b2a29c724b10b93819a087ea95","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"date-trunc","SourceDatabase":"center","Version":"18","Locale":"en","Title":"date_trunc","Summary":"Truncate to specified precision; see Section 9.9.2","BodyHTML":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" rel=\"nofollow\"\u003eSection 9.9.2\u003c/a\u003e","SourceRevision":"wiki-repair-20261023:f41dfeff194fd51d45d1ca6c58ca485d6cafd9f5e7e4b8b487877cb550638cff","ContentHash":"ad8f118eea7891f7c66a3485f610ac953ee3d7d2fbaacc5a496ff7daa3b723d5","Payload":{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","signatures":[{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', timestamp '2001-02-16 20:38:40')","result":"2001-02-16 20:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp\u003c/code\u003e","returns":"timestamp","text":"date_trunc ( text, timestamp ) → timestamp","zh_from":"same-version-manual"},{"description":"Truncate to specified precision in the specified time zone; see Section 9.9.2","description_html":"Truncate to specified precision in the specified time zone; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"在规定的时区中截断到指定的精度；参见第 9.9.2 节","description_zh_html":"在规定的时区中截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')","result":"2001-02-16 13:00:00+00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp with time zone\u003c/code\u003e","returns":"timestamp with time zone","text":"date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone","zh_from":"same-version-manual"},{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', interval '2 days 3 hours 40 minutes')","result":"2 days 03:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einterval\u003c/code\u003e","returns":"interval","text":"date_trunc ( text, interval ) → interval","zh_from":"same-version-manual"},{"description":"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).","description_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e is a value expression of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e. (Values of type \u003ccode class=\"type\"\u003edate\u003c/code\u003e and \u003ccode class=\"type\"\u003etime\u003c/code\u003e are cast automatically to \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, respectively.) \u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e selects to which precision to truncate the input value. The return value is likewise of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, and it has all fields that are less significant than the selected one set to zero (or one, for day and month).","description_zh":"source 是 timestamp、timestamp with time zone 或 interval 类型的值表达式。（date 和 time 类型的值会分别自动转换为 timestamp 或 interval。）field 选择输入值的截断精度。返回值同样为 timestamp、timestamp with time zone 或 interval 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","description_zh_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e 是 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型的值表达式。（\u003ccode class=\"type\"\u003edate\u003c/code\u003e 和 \u003ccode class=\"type\"\u003etime\u003c/code\u003e 类型的值会分别自动转换为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e。）\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e 选择输入值的截断精度。返回值同样为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","examples":[],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003etime_zone\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e])","returns":"","text":"date_trunc(field, source [, time_zone])","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"e69ae7c9244301c111d5637a94dfa1ff22b88711e81f8e45a4836bdfc05bcebe","Text":"date_trunc ( text, timestamp ) → timestamp","Returns":"timestamp","Payload":{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', timestamp '2001-02-16 20:38:40')","result":"2001-02-16 20:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp\u003c/code\u003e","returns":"timestamp","text":"date_trunc ( text, timestamp ) → timestamp","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":1,"Hash":"8dc36a58c31761d131b688542890787655b685348ca10bb729cf0134bb3440e7","Text":"date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone","Returns":"timestamp with time zone","Payload":{"description":"Truncate to specified precision in the specified time zone; see Section 9.9.2","description_html":"Truncate to specified precision in the specified time zone; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"在规定的时区中截断到指定的精度；参见第 9.9.2 节","description_zh_html":"在规定的时区中截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')","result":"2001-02-16 13:00:00+00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp with time zone\u003c/code\u003e","returns":"timestamp with time zone","text":"date_trunc ( text, timestamp with time zone, text ) → timestamp with time zone","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":2,"Hash":"feb5b4f1af75550faac53dc09777ed8d3533851cb64ec499cb5b2cec267cbc3c","Text":"date_trunc ( text, interval ) → interval","Returns":"interval","Payload":{"description":"Truncate to specified precision; see Section 9.9.2","description_html":"Truncate to specified precision; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003eSection 9.9.2\u003c/a\u003e","description_zh":"截断到指定的精度；参见第 9.9.2 节","description_zh_html":"截断到指定的精度；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC\" title=\"9.9.2. date_trunc\"\u003e第 9.9.2 节\u003c/a\u003e","examples":[{"expr":"date_trunc('hour', interval '2 days 3 hours 40 minutes')","result":"2 days 03:00:00"}],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003ccode class=\"type\"\u003einterval\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einterval\u003c/code\u003e","returns":"interval","text":"date_trunc ( text, interval ) → interval","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":3,"Hash":"1a6b8950a6226db039c3abbbda56387ce165547807e6da3e65204745cb5eec7c","Text":"date_trunc(field, source [, time_zone])","Returns":"","Payload":{"description":"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).","description_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e is a value expression of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e. (Values of type \u003ccode class=\"type\"\u003edate\u003c/code\u003e and \u003ccode class=\"type\"\u003etime\u003c/code\u003e are cast automatically to \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, respectively.) \u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e selects to which precision to truncate the input value. The return value is likewise of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, or \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, and it has all fields that are less significant than the selected one set to zero (or one, for day and month).","description_zh":"source 是 timestamp、timestamp with time zone 或 interval 类型的值表达式。（date 和 time 类型的值会分别自动转换为 timestamp 或 interval。）field 选择输入值的截断精度。返回值同样为 timestamp、timestamp with time zone 或 interval 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","description_zh_html":"\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e 是 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型的值表达式。（\u003ccode class=\"type\"\u003edate\u003c/code\u003e 和 \u003ccode class=\"type\"\u003etime\u003c/code\u003e 类型的值会分别自动转换为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e。）\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e 选择输入值的截断精度。返回值同样为 \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e、\u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e 或 \u003ccode class=\"type\"\u003einterval\u003c/code\u003e 类型，其中低于所选精度的所有字段都设为零（日和月则设为一）。","examples":[],"html":"\u003ccode class=\"function\"\u003edate_trunc\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003efield\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003etime_zone\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e])","returns":"","text":"date_trunc(field, source [, time_zone])","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
