PostgreSQL type conversion function

Convert a field value from one type to another.

function return type describe example
to_char(timestamp, text) text convert timestamp to string to_char(current_timestamp, 'HH12:MI:SS')
to_char(interval, text) text convert time interval to string to_char(interval '15h 2m 12s', 'HH24:MI:SS')
to_char(int, text) text integer to string to_char(125, '999')
to_char(double precision, text) text Convert double to string to_char(125.8::real, '999D9')
to_char(numeric, text) text number to string to_char(-125.8, '999D99S')
to_date(text, text) date string to date to_date('05 Dec 2000', 'DD Mon YYYY')
to_number(text, text) numeric convert string to number to_number('12,454.8-', '99G999D9S')
to_timestamp(text, text) timestamp Convert to the specified time format time zone convert string to time stamp to_timestamp('05 Dec 2000', 'DD Mon YYYY')
to_timestamp(double precision) timestamp Convert UNIX epoch to timestamp to_timestamp(1284352323)

Guess you like

Origin blog.csdn.net/yeyaozhifengqi/article/details/130349311