{"Entry":{"collection":"guc","key":"DateStyle","name":"DateStyle","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Locale and Formatting","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"}],"content_hash":"b17084010ed4862fe27432b92eac67c502252bd7969137a6e8b52ca84fdea284","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"ISO, MDY"}],"editorial":{"advice":{"olap":"Pin DateStyle for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema.","oltp":"Treat DateStyle as an application contract, not a performance knob. Standardize it per role or connection pool and keep wire formats explicit where clients parse text.","small":"Keep the upstream or locale-derived value unless a client requires another one. A smaller server gains no capacity from changing DateStyle."},"mechanism":["DateStyle sets the display format for date and time values. Also controls interpretation of ambiguous date inputs. The value has two independent parts: an output style and a DMY/MDY/YMD field order; the latter also resolves ambiguous input.","DateStyle is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It changes representation, parsing, or locale behavior at the client boundary rather than physical storage. Coordinate it with the other locale and formatting settings and with driver-native binary or typed protocols."],"pitfalls":["Changing DateStyle in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Assuming a presentation setting changes stored values or server-side type semantics.","Changing a role or database default without testing text-parsing clients, exports, and pooled sessions.","Parsing an ambiguous value such as 01/02/03 under an unexpected MDY/DMY order."],"references":[{"title":"PostgreSQL 19 Beta 4: DateStyle","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-DATESTYLE"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["IntervalStyle","TimeZone","lc_time","timezone_abbreviations","log_timezone"],"summary":"DateStyle is the PostgreSQL setting that defines the display format for date and time values."},"enumvals":[],"first_version":"7.4","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:30.707238+08:00","intro_commit":{},"key":"datestyle","last_version":"20","max_val":"","min_val":"","name":"DateStyle","position":0,"present_in":["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"],"short_desc":"Sets the display format for date and time values, as well as the rules for interpreting ambiguous date input values.","short_desc_zh":"","source_rev":"english-manuals:dededa07d88dc5b733736fe2c8164cb058417d7a14cc06e1bf00332b438d9ad4","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"DateStyle","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"DateStyle","SourceRevision":"english-manuals:dededa07d88dc5b733736fe2c8164cb058417d7a14cc06e1bf00332b438d9ad4","Facts":{"boot_val":"ISO, MDY","category":"Client Connection Defaults / Locale and Formatting","context":"user","description":"Sets the display format for date and time values, as well as the rules for interpreting ambiguous date input values. For historical reasons, this variable contains two independent components: the output format specification (ISO, Postgres, SQL, or German) and the input/output specification for year/month/day ordering (DMY, MDY, or YMD). These can be set separately or together. The keywords Euro and European are synonyms for DMY; the keywords US, NonEuro, and NonEuropean are synonyms for MDY. See Section 8.5 for more information. The built-in default is ISO, MDY, but initdb will initialize the configuration file with a setting that corresponds to the behavior of the chosen lc_time locale.","doc":{"anchor":"GUC-DATESTYLE","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"Also controls interpretation of ambiguous date inputs.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"DateStyle","short_desc":"Sets the display format for date and time values.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-DATESTYLE","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"DateStyle","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"DateStyle","Summary":"","BodyHTML":"\u003cp\u003e设置日期和时间值的显示格式，以及解释有歧义的日期输入值的规则。由于历史原因，这个变量包含两个独立的部分：输出格式声明（\u003ccode\u003eISO\u003c/code\u003e、\u003ccode\u003ePostgres\u003c/code\u003e、\u003ccode\u003eSQL\u003c/code\u003e或\u003ccode\u003eGerman\u003c/code\u003e）、输入/输出的年/月/日顺序（\u003ccode\u003eDMY\u003c/code\u003e、\u003ccode\u003eMDY\u003c/code\u003e或\u003ccode\u003eYMD\u003c/code\u003e）。这些可以被独立设置或者一起设置。关键字\u003ccode\u003eEuro\u003c/code\u003e和\u003ccode\u003eEuropean\u003c/code\u003e是\u003ccode\u003eDMY\u003c/code\u003e的同义词；关键字\u003ccode\u003eUS\u003c/code\u003e、\u003ccode\u003eNonEuro\u003c/code\u003e和\u003ccode\u003eNonEuropean\u003c/code\u003e是\u003ccode\u003eMDY\u003c/code\u003e的同义词。详见\u003ca href=\"/docs/18/datatype-datetime.html\" rel=\"nofollow\"\u003e第 8.5 节\u003c/a\u003e。内置默认值是\u003ccode\u003eISO, MDY\u003c/code\u003e，但是\u003cspan\u003einitdb\u003c/span\u003e将用对应于选中的\u003ccode\u003elc_time\u003c/code\u003e区域设置行为的设置初始化配置文件。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"96c2d953d8a3d6799827e073736b4a6bd7e74bae3bc2c81007152433ba456ef0","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置日期和时间值的显示格式，以及解释有歧义的日期输入值的规则。由于历史原因，这个变量包含两个独立的部分：输出格式声明（\u003ccode class=\"literal\"\u003eISO\u003c/code\u003e、\u003ccode class=\"literal\"\u003ePostgres\u003c/code\u003e、\u003ccode class=\"literal\"\u003eSQL\u003c/code\u003e或\u003ccode class=\"literal\"\u003eGerman\u003c/code\u003e）、输入/输出的年/月/日顺序（\u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e、\u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e或\u003ccode class=\"literal\"\u003eYMD\u003c/code\u003e）。这些可以被独立设置或者一起设置。关键字\u003ccode class=\"literal\"\u003eEuro\u003c/code\u003e和\u003ccode class=\"literal\"\u003eEuropean\u003c/code\u003e是\u003ccode class=\"literal\"\u003eDMY\u003c/code\u003e的同义词；关键字\u003ccode class=\"literal\"\u003eUS\u003c/code\u003e、\u003ccode class=\"literal\"\u003eNonEuro\u003c/code\u003e和\u003ccode class=\"literal\"\u003eNonEuropean\u003c/code\u003e是\u003ccode class=\"literal\"\u003eMDY\u003c/code\u003e的同义词。详见\u003ca href=\"/docs/18/datatype-datetime.html\" title=\"8.5. 日期/时间类型\"\u003e第 8.5 节\u003c/a\u003e。内置默认值是\u003ccode class=\"literal\"\u003eISO, MDY\u003c/code\u003e，但是\u003cspan class=\"application\"\u003einitdb\u003c/span\u003e将用对应于选中的\u003ccode class=\"varname\"\u003elc_time\u003c/code\u003e区域设置行为的设置初始化配置文件。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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":null,"Spellings":null,"SQLState":null,"Evidence":null}
