↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Functions

to_char

Converts time stamp to string according to the given format.

English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

group
formatting
group label
数据类型格式化函数
lang
en
layout
table-new
pages
functions-formatting.html
prose only
false

Definition PG 18

Converts time stamp to string according to the given format.

Signatures and overloads

to_char ( timestamp, text ) → text → text
Converts time stamp to string according to the given format.
to_char ( timestamp with time zone, text ) → text → text
Converts time stamp to string according to the given format.
to_char ( interval, text ) → text → text
Converts interval to string according to the given format.
to_char ( numeric_type, text ) → text → text
Converts number to string according to the given format; available for integer, bigint, numeric, real, double precision.

Compare versions

Complete source facts

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"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c

Text language: en · wiki-repair-20261023:03396880172024c4ed095491c865b9fbd017aa462e218d907d88d45eb760f08c