{"Entry":{"collection":"func","key":"to-char","name":"to_char","aliases":[],"metadata":{"changed_in":["7.2"],"changes":[{"descriptions_changed":true,"doc_overhaul":false,"from":"7.1","group_changed":null,"signatures":{"added":["to_char ( interval, text ) → text"],"removed":[]},"status":"changed","to":"7.2"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"2d2d837d9a962abcd54fe95fd88cce189022fa62fc8effbe681ea815d400c8f0","derived_content_hash":"9746b7c8754553245c1784ffa05b73de68b87c82f79f38506fff8de4a4735d42","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"7.1","group":"formatting","group_label":"Data Type Formatting Functions","groups":["formatting"],"imported_at":"2026-09-27T17:57:28.492173+08:00","last_version":"20","name":"to_char","name_key":"to_char","position":7000,"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:7529b0a3d610ed5472ee4574d336bc9f3f2b901c292c3a07647a58e442a7583b","receipt_sha256":"ca076d19e8c375fdd4910f636643c35787a7c31ca6b08297e73e3836319df1e2","repair":"wiki-repair-20261023"},"signature":"to_char ( timestamp, text ) → text","signature_count":4,"slug":"to-char","source_rev":"wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c","summary":"Converts time stamp to string according to the given format.","summary_zh":""}},"Definition":{"Collection":"func","Key":"to-char","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"to-char","SourceRevision":"wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c","Facts":{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","doc":{"anchor":"FUNCTIONS-FORMATTING-TABLE","file":"functions-formatting.html","sha256":"17b479f1cd22bc7308cefeb2a307da2ef41a0e2864a6ef7d229b93257f07ad97","slug":"18"},"documentation_revision":{"inputs":[{"file":"functions-formatting.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"17b479f1cd22bc7308cefeb2a307da2ef41a0e2864a6ef7d229b93257f07ad97","version":"18.7"},{"file":"functions-formatting.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"7819c15fc71d5d2494ecc37cbef3fef041440c894a885e853c7e544c631500b4","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"group":"formatting","group_label":"数据类型格式化函数","lang":"en","layout":"table-new","pages":["functions-formatting.html"],"prose_only":false,"signatures":[{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp, text ) → text","zh_from":"same-version-manual"},{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp with time zone, text ) → text","zh_from":"same-version-manual"},{"description":"Converts interval to string according to the given format.","description_html":"Converts interval to string according to the given format.","description_zh":"根据给定的格式将时间间隔转换为字符串。","description_zh_html":"根据给定的格式将时间间隔转换为字符串。","examples":[{"expr":"to_char(interval '15h 2m 12s', 'HH24:MI:SS')","result":"15:02:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( interval, text ) → text","zh_from":"same-version-manual"},{"description":"Converts number to string according to the given format; available for integer, bigint, numeric, real, double precision.","description_html":"Converts number to string according to the given format; available for \u003ccode class=\"type\"\u003einteger\u003c/code\u003e, \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e, \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003ccode class=\"type\"\u003ereal\u003c/code\u003e, \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e.","description_zh":"根据给定的格式将数字转换为字符串；适用于 integer，bigint，numeric，real，double precision。","description_zh_html":"根据给定的格式将数字转换为字符串；适用于 \u003ccode class=\"type\"\u003einteger\u003c/code\u003e，\u003ccode class=\"type\"\u003ebigint\u003c/code\u003e，\u003ccode class=\"type\"\u003enumeric\u003c/code\u003e，\u003ccode class=\"type\"\u003ereal\u003c/code\u003e，\u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e。","examples":[{"expr":"to_char(125, '999')","result":"125"},{"expr":"to_char(125.8::real, '999D9')","result":"125.8"},{"expr":"to_char(-125.8, '999D99S')","result":"125.80-"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumeric_type\u003c/code\u003e\u003c/em\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( numeric_type, text ) → text","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-formatting.html","sha256":"5c38a9bb5d5fa6323ad97393705e6b530fd6b8da96c63f6591468103b2af099e"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-FORMATTING-TABLE","file":"functions-formatting.html","sha256":"17b479f1cd22bc7308cefeb2a307da2ef41a0e2864a6ef7d229b93257f07ad97","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"to-char","SourceDatabase":"center","Version":"18","Locale":"en","Title":"to_char","Summary":"Converts time stamp to string according to the given format.","BodyHTML":"Converts time stamp to string according to the given format.","SourceRevision":"wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c","ContentHash":"ee07d94f7c4d83de7dc7f17805330b63662b2650fe3d858af2eb7266a61b9f12","Payload":{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","signatures":[{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp, text ) → text","zh_from":"same-version-manual"},{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp with time zone, text ) → text","zh_from":"same-version-manual"},{"description":"Converts interval to string according to the given format.","description_html":"Converts interval to string according to the given format.","description_zh":"根据给定的格式将时间间隔转换为字符串。","description_zh_html":"根据给定的格式将时间间隔转换为字符串。","examples":[{"expr":"to_char(interval '15h 2m 12s', 'HH24:MI:SS')","result":"15:02:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( interval, text ) → text","zh_from":"same-version-manual"},{"description":"Converts number to string according to the given format; available for integer, bigint, numeric, real, double precision.","description_html":"Converts number to string according to the given format; available for \u003ccode class=\"type\"\u003einteger\u003c/code\u003e, \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e, \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003ccode class=\"type\"\u003ereal\u003c/code\u003e, \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e.","description_zh":"根据给定的格式将数字转换为字符串；适用于 integer，bigint，numeric，real，double precision。","description_zh_html":"根据给定的格式将数字转换为字符串；适用于 \u003ccode class=\"type\"\u003einteger\u003c/code\u003e，\u003ccode class=\"type\"\u003ebigint\u003c/code\u003e，\u003ccode class=\"type\"\u003enumeric\u003c/code\u003e，\u003ccode class=\"type\"\u003ereal\u003c/code\u003e，\u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e。","examples":[{"expr":"to_char(125, '999')","result":"125"},{"expr":"to_char(125.8::real, '999D9')","result":"125.8"},{"expr":"to_char(-125.8, '999D99S')","result":"125.80-"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumeric_type\u003c/code\u003e\u003c/em\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( numeric_type, text ) → text","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":"1bfbfa3879c517e3c5ab80f29d2ba623c6c4c7d04bd347a277afee6f9134ca94","Text":"to_char ( timestamp, text ) → text","Returns":"text","Payload":{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp, text ) → text","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":1,"Hash":"d242e9cfefac554283bf8da66ed613be47e44aff1cef9f93ebb8691e7efccee5","Text":"to_char ( timestamp with time zone, text ) → text","Returns":"text","Payload":{"description":"Converts time stamp to string according to the given format.","description_html":"Converts time stamp to string according to the given format.","description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","examples":[{"expr":"to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')","result":"05:31:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003etimestamp with time zone\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( timestamp with time zone, text ) → text","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":2,"Hash":"d2bd8622d2baf1338de23189b198b2fbf0e8f09f441a45f7f6d1e8590ef32ef6","Text":"to_char ( interval, text ) → text","Returns":"text","Payload":{"description":"Converts interval to string according to the given format.","description_html":"Converts interval to string according to the given format.","description_zh":"根据给定的格式将时间间隔转换为字符串。","description_zh_html":"根据给定的格式将时间间隔转换为字符串。","examples":[{"expr":"to_char(interval '15h 2m 12s', 'HH24:MI:SS')","result":"15:02:12"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003ccode class=\"type\"\u003einterval\u003c/code\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( interval, text ) → text","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":3,"Hash":"7025f768a52d444085db06e34b8fb0aa4a34aedb82e4c8fe9de932025f6216fb","Text":"to_char ( numeric_type, text ) → text","Returns":"text","Payload":{"description":"Converts number to string according to the given format; available for integer, bigint, numeric, real, double precision.","description_html":"Converts number to string according to the given format; available for \u003ccode class=\"type\"\u003einteger\u003c/code\u003e, \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e, \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003ccode class=\"type\"\u003ereal\u003c/code\u003e, \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e.","description_zh":"根据给定的格式将数字转换为字符串；适用于 integer，bigint，numeric，real，double precision。","description_zh_html":"根据给定的格式将数字转换为字符串；适用于 \u003ccode class=\"type\"\u003einteger\u003c/code\u003e，\u003ccode class=\"type\"\u003ebigint\u003c/code\u003e，\u003ccode class=\"type\"\u003enumeric\u003c/code\u003e，\u003ccode class=\"type\"\u003ereal\u003c/code\u003e，\u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e。","examples":[{"expr":"to_char(125, '999')","result":"125"},{"expr":"to_char(125.8::real, '999D9')","result":"125.8"},{"expr":"to_char(-125.8, '999D99S')","result":"125.80-"}],"html":"\u003ccode class=\"function\"\u003eto_char\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumeric_type\u003c/code\u003e\u003c/em\u003e, \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"to_char ( numeric_type, text ) → text","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
