PostgreSQL类型转换函数
企业开发
2023-07-01 23:34:49
阅读次数: 0
把字段值由一种类型转换成另一种类型。
函数 |
返回类型 |
描述 |
实例 |
to_char(timestamp, text) |
text |
将时间戳转换为字符串 |
to_char(current_timestamp, 'HH12:MI:SS') |
to_char(interval, text) |
text |
将时间间隔转换为字符串 |
to_char(interval '15h 2m 12s', 'HH24:MI:SS') |
to_char(int, text) |
text |
整型转换为字符串 |
to_char(125, '999') |
to_char(double precision, text) |
text |
双精度转换为字符串 |
to_char(125.8::real, '999D9') |
to_char(numeric, text) |
text |
数字转换为字符串 |
to_char(-125.8, '999D99S') |
to_date(text, text) |
date |
字符串转换为日期 |
to_date('05 Dec 2000', 'DD Mon YYYY') |
to_number(text, text) |
numeric |
转换字符串为数字 |
to_number('12,454.8-', '99G999D9S') |
to_timestamp(text, text) |
timestamp |
转换为指定的时间格式 time zone convert string to time stamp |
to_timestamp('05 Dec 2000', 'DD Mon YYYY') |
to_timestamp(double precision) |
timestamp |
把UNIX纪元转换成时间戳 |
to_timestamp(1284352323) |
转载自blog.csdn.net/yeyaozhifengqi/article/details/130349311