{"Entry":{"collection":"func","key":"date-bin","name":"date_bin","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"13","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"14"}],"content_hash":"a0c39e7544aa0b56fb1ed63038e6511d9f18a81d058faf02228a7ca24b227d79","first_version":"14","group":"datetime","group_label":"Date/Time Functions And Operators","groups":["datetime"],"imported_at":"2026-09-14T21:49:48.697746+08:00","last_version":"20","name":"date_bin","name_key":"date_bin","position":8006,"present_in":["14","15","16","17","18","19","20"],"signature":"date_bin ( interval, timestamp, timestamp ) → timestamp","signature_count":2,"slug":"date-bin","source_rev":"2026-09-14T13:14:25.684213+00:00@99e6866c","summary":"Bin input into specified interval aligned with specified origin; see Section 9.9.3","summary_zh":""}},"Definition":{"Collection":"func","Key":"date-bin","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"date-bin","SourceRevision":"2026-09-14T13:14:25.684213+00:00@99e6866c","Facts":{"description":"Bin input into specified interval aligned with specified origin; see Section 9.9.3","description_html":"Bin input into specified interval aligned with specified origin; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" title=\"9.9.3. date_bin\"\u003eSection 9.9.3\u003c/a\u003e","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-DATETIME-TABLE","file":"functions-datetime.html","slug":"18"},"group":"datetime","group_label":"Date/Time Functions And Operators","lang":"en","layout":"table-new","pages":["functions-datetime.html"],"prose_only":false,"signatures":[{"description":"Bin input into specified interval aligned with specified origin; see Section 9.9.3","description_html":"Bin input into specified interval aligned with specified origin; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" title=\"9.9.3. date_bin\"\u003eSection 9.9.3\u003c/a\u003e","description_zh":"","description_zh_html":"","examples":[{"expr":"date_bin('15 minutes', timestamp '2001-02-16 20:38:40', timestamp '2001-02-16 20:05:00')","result":"2001-02-16 20:35:00"}],"html":"\u003ccode class=\"function\"\u003edate_bin\u003c/code\u003e ( \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp\u003c/code\u003e","returns":"timestamp","text":"date_bin ( interval, timestamp, timestamp ) → timestamp","zh_from":""},{"description":"source is a value expression of type timestamp or timestamp with time zone. (Values of type date are cast automatically to timestamp.) stride is a value expression of type interval. The return value is likewise of type timestamp or timestamp with time zone, and it marks the beginning of the bin into which the source is placed.","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 or \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e. (Values of type \u003ccode class=\"type\"\u003edate\u003c/code\u003e are cast automatically to \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e.) \u003cem class=\"replaceable\"\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e is a value expression of type \u003ccode class=\"type\"\u003einterval\u003c/code\u003e. The return value is likewise of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e or \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, and it marks the beginning of the bin into which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e is placed.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003edate_bin\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eorigin\u003c/code\u003e\u003c/em\u003e)","returns":"","text":"date_bin(stride, source, origin)","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-DATETIME-TABLE","file":"functions-datetime.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"date-bin","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"date_bin","Summary":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见第 9.9.3 节","BodyHTML":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" rel=\"nofollow\"\u003e第 9.9.3 节\u003c/a\u003e\u003cpre\u003edate_bin ( interval, timestamp, timestamp ) → timestamp\u003c/pre\u003e将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" rel=\"nofollow\"\u003e第 9.9.3 节\u003c/a\u003e\u003cpre\u003edate_bin(stride, source, origin)\u003c/pre\u003e\u003cem\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e是\u003ccode\u003etimestamp\u003c/code\u003e 或 \u003ccode\u003etimestamp with time zone\u003c/code\u003e类型的值表达式。（类型\u003ccode\u003edate\u003c/code\u003e的值会自动转换为\u003ccode\u003etimestamp\u003c/code\u003e。）\u003cem\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e 是\u003ccode\u003einterval\u003c/code\u003e类型的值表达式。返回值同样是\u003ccode\u003etimestamp\u003c/code\u003e 或 \u003ccode\u003etimestamp with time zone\u003c/code\u003e类型，并且它表示\u003cem\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e所在分箱的起点。","SourceRevision":"ca936764","ContentHash":"2db480fdb5a60296a5436d89ad40e1427e7415640e0542bc3a9d4e47ef01bd1a","Payload":{"description_zh":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见第 9.9.3 节","description_zh_html":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" title=\"9.9.3. date_bin\"\u003e第 9.9.3 节\u003c/a\u003e","signatures":[{"description_zh":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见第 9.9.3 节","description_zh_html":"将输入按指定的间隔进行分箱（bin），对齐到指定的原点；参见\u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" title=\"9.9.3. date_bin\"\u003e第 9.9.3 节\u003c/a\u003e","returns":"timestamp","text":"date_bin ( interval, timestamp, timestamp ) → timestamp","zh_from":"doc"},{"description_zh":"source是timestamp 或 timestamp with time zone类型的值表达式。（类型date的值会自动转换为timestamp。）stride 是interval类型的值表达式。返回值同样是timestamp 或 timestamp with time zone类型，并且它表示source所在分箱的起点。","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\"\u003edate\u003c/code\u003e的值会自动转换为\u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e。）\u003cem class=\"replaceable\"\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e 是\u003ccode class=\"type\"\u003einterval\u003c/code\u003e类型的值表达式。返回值同样是\u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e 或 \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e类型，并且它表示\u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e所在分箱的起点。","returns":"","text":"date_bin(stride, source, origin)","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"81fb837f54124671227d96e30b0e316416c4a5d47e804f4e2471c42c5a3ffff1","Text":"date_bin ( interval, timestamp, timestamp ) → timestamp","Returns":"timestamp","Payload":{"description":"Bin input into specified interval aligned with specified origin; see Section 9.9.3","description_html":"Bin input into specified interval aligned with specified origin; see \u003ca href=\"/docs/18/functions-datetime.html#FUNCTIONS-DATETIME-BIN\" title=\"9.9.3. date_bin\"\u003eSection 9.9.3\u003c/a\u003e","description_zh":"","description_zh_html":"","examples":[{"expr":"date_bin('15 minutes', timestamp '2001-02-16 20:38:40', timestamp '2001-02-16 20:05:00')","result":"2001-02-16 20:35:00"}],"html":"\u003ccode class=\"function\"\u003edate_bin\u003c/code\u003e ( \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etimestamp\u003c/code\u003e","returns":"timestamp","text":"date_bin ( interval, timestamp, timestamp ) → timestamp","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"6f7c9548b9b8ce4bd1dfe27391d4bc838a6c86b9333a3f2f9efc843d03b28f5f","Text":"date_bin(stride, source, origin)","Returns":"","Payload":{"description":"source is a value expression of type timestamp or timestamp with time zone. (Values of type date are cast automatically to timestamp.) stride is a value expression of type interval. The return value is likewise of type timestamp or timestamp with time zone, and it marks the beginning of the bin into which the source is placed.","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 or \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e. (Values of type \u003ccode class=\"type\"\u003edate\u003c/code\u003e are cast automatically to \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e.) \u003cem class=\"replaceable\"\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e is a value expression of type \u003ccode class=\"type\"\u003einterval\u003c/code\u003e. The return value is likewise of type \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e or \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, and it marks the beginning of the bin into which the \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e is placed.","description_zh":"","description_zh_html":"","examples":[],"html":"\u003ccode class=\"function\"\u003edate_bin\u003c/code\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003estride\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003esource\u003c/code\u003e\u003c/em\u003e, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eorigin\u003c/code\u003e\u003c/em\u003e)","returns":"","text":"date_bin(stride, source, origin)","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
