| 函数 | 
返回 | 
描述 | 
例子 | 
| to_char(timestamp, text) | 
text | 
把 timestamp 转换成 string | 
to_char(timestamp 'now','HH12:MI:SS') | 
| to_char(int, text) | 
text | 
把 int4/int8 转换成 string | 
to_char(125, '999') | 
| to_char(float, text) | 
text | 
把 float4/float8 转换成 string | 
to_char(125.8, '999D9') | 
| to_char(numeric, text) | 
text | 
把 numeric 转换成 string | 
to_char(numeric '-125.8', '999D99S') | 
| to_date(text, text) | 
date | 
把 string 转换成 date | 
to_date('05 Dec 2000', 'DD Mon YYYY') | 
| to_timestamp(text, text) | 
date | 
把 string 转换成 timestamp | 
to_timestamp('05 Dec 2000', 'DD Mon YYYY') | 
| to_number(text, text) | 
numeric | 
把 string 转换成 numeric | 
to_number('12,454.8-', '99G999D9S') | 
| 输入 | 
输出 | 
| to_char(now(),'Day, HH12:MI:SS') | 
'Tuesday , 05:39:18' | 
| to_char(now(),'FMDay, HH12:MI:SS') | 
'Tuesday, 05:39:18' | 
| to_char(-0.1,'99.99') | 
' -.10' | 
| to_char(-0.1,'FM9.99') | 
'-.1' | 
| to_char(0.1,'0.9') | 
' 0.1' | 
| to_char(12,'9990999.9') | 
' 0012.0' | 
| to_char(12,'FM9990999.9') | 
'0012' | 
| to_char(485,'999') | 
' 485' | 
| to_char(-485,'999') | 
'-485' | 
| to_char(485,'9 9 9') | 
' 4 8 5' | 
| to_char(1485,'9,999') | 
' 1,485' | 
| to_char(1485,'9G999') | 
' 1 485' | 
| to_char(148.5,'999.999') | 
' 148.500' | 
| to_char(148.5,'999D999') | 
' 148,500' | 
| to_char(3148.5,'9G999D999') | 
' 3 148,500' | 
| to_char(-485,'999S') | 
'485-' | 
| to_char(-485,'999MI') | 
'485-' | 
| to_char(485,'999MI') | 
'485' | 
| to_char(485,'PL999') | 
'+485' | 
| to_char(485,'SG999') | 
'+485' | 
| to_char(-485,'SG999') | 
'-485' | 
| to_char(-485,'9SG99') | 
'4-85' | 
| to_char(-485,'999PR') | 
'<485>' | 
| to_char(485,'L999') | 
'DM 485 | 
| to_char(485,'RN') | 
' CDLXXXV' | 
| to_char(485,'FMRN') | 
'CDLXXXV' | 
| to_char(5.2,'FMRN') | 
V | 
| to_char(482,'999th') | 
' 482nd' | 
| to_char(485, '"Good number:"999') | 
'Good number: 485' | 
| to_char(485.8,'"Pre-decimal:"999" Post-decimal:" .999') | 
'Pre-decimal: 485 Post-decimal: .800' | 
| to_char(12,'99V999') | 
' 12000' | 
| to_char(12.4,'99V999') | 
' 12400' | 
| to_char(12.45, '99V9') | 
' 125' |