{"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","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"],"signature":"to_char ( timestamp, text ) → text","signature_count":4,"slug":"to-char","source_rev":"b7bd9cda","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":"b7bd9cda","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","slug":"18"},"group":"formatting","group_label":"Data Type Formatting Functions","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":""},{"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":""},{"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":""},{"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":"","description_zh_html":"","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":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-FORMATTING-TABLE","file":"functions-formatting.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"to-char","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"to_char","Summary":"根据给定的格式将时间戳转换为字符串。","BodyHTML":"根据给定的格式将时间戳转换为字符串。\u003cpre\u003eto_char ( timestamp, text ) → text\u003c/pre\u003e根据给定的格式将时间戳转换为字符串。\u003cpre\u003eto_char ( timestamp with time zone, text ) → text\u003c/pre\u003e根据给定的格式将时间戳转换为字符串。\u003cpre\u003eto_char ( interval, text ) → text\u003c/pre\u003e根据给定的格式将时间间隔转换为字符串。\u003cpre\u003eto_char ( numeric_type, text ) → text\u003c/pre\u003e根据给定的格式将数字转换为字符串；适用于 \u003ccode\u003einteger\u003c/code\u003e，\u003ccode\u003ebigint\u003c/code\u003e，\u003ccode\u003enumeric\u003c/code\u003e，\u003ccode\u003ereal\u003c/code\u003e，\u003ccode\u003edouble precision\u003c/code\u003e。","SourceRevision":"ca936764","ContentHash":"4a2cff1f610367616548000ce4d185a25f2415a7a59100556b966ab9a8172b1a","Payload":{"description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","signatures":[{"description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","returns":"text","text":"to_char ( timestamp, text ) → text","zh_from":"doc"},{"description_zh":"根据给定的格式将时间戳转换为字符串。","description_zh_html":"根据给定的格式将时间戳转换为字符串。","returns":"text","text":"to_char ( timestamp with time zone, text ) → text","zh_from":"doc"},{"description_zh":"根据给定的格式将时间间隔转换为字符串。","description_zh_html":"根据给定的格式将时间间隔转换为字符串。","returns":"text","text":"to_char ( interval, text ) → text","zh_from":"doc"},{"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。","returns":"text","text":"to_char ( numeric_type, text ) → text","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","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":""}},{"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":""}},{"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":""}},{"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":"","description_zh_html":"","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":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
