{"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"}],"derived_content_hash":"55df4888baaf1aa09c325f806060bfe0c9faf82c6ae2b9cdb60f2c3f40c204ec","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"],"repair_provenance":{"original_source_revision":"english-manuals:dededa07d88dc5b733736fe2c8164cb058417d7a14cc06e1bf00332b438d9ad4","receipt_sha256":"2b25ab0994824e8fada3ecf2d159663a0217677e5c60a0630cbf6f16a9acf30b","repair":"wiki-repair-20261023"},"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":"wiki-repair-20261023:bc70b68072fba733b88c148fb4947719783adb59faf5cf7065964c80086c19ce","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"DateStyle","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"DateStyle","SourceRevision":"wiki-repair-20261023:bc70b68072fba733b88c148fb4947719783adb59faf5cf7065964c80086c19ce","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.","description_zh":"设置日期和时间值的显示格式，以及解释有歧义的日期输入值的规则。由于历史原因，这个变量包含两个独立的部分：输出格式声明（ISO、Postgres、SQL 或 German）、输入/输出的年/月/日顺序（DMY、MDY 或 YMD）。这些可以被独立设置或者一起设置。关键字 Euro 和 European 是 DMY 的同义词；关键字 US、NonEuro 和 NonEuropean 是 MDY 的同义词。详见第 8.5 节。内置默认值是 ISO, MDY，但是 initdb 将用对应于选中的 lc_time 区域设置行为的设置初始化配置文件。","description_zh_html":"\u003cp\u003e\n        设置日期和时间值的显示格式，以及解释有歧义的日期输入值的规则。由于历史原因，这个变量包含两个独立的部分：输出格式声明（\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 class=\"xref\" href=\"/zh/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 区域设置行为的设置初始化配置文件。\n       \u003c/p\u003e","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","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-client.html","sha256":"1882f8fd5576909c4fcc44af53077378871e05f5be67723f20fe300273024767"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"string","zh_from":"same-version-pgdoc"},"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":"center","Version":"18","Locale":"en","Title":"DateStyle","Summary":"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.","BodyHTML":"\u003cp\u003eSets 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.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:bc70b68072fba733b88c148fb4947719783adb59faf5cf7065964c80086c19ce","ContentHash":"df377f42b57122562fa5e5d4d7087b7979b5584665f13fefc0b57ffb8b08c1b9","Payload":{"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."}},"RequestedLocale":"en","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}
