Trying to format the number as per the given format and culture.
Given:
-4059587.225000, --Value
'#,##0.00;(#,##0.00)' --Format
'en-US' --Culture
Will have many patterns, the given one is for example.
Expected output: (4,059,587.23)
In SQL Server we have format()
function, what’s the equivalent in PostgreSQL?
My try:
select to_char( -4059587.225000, '#,##0.00;(#,##0.00)' );
Error:
multiple decimal points
2
Answers
Use
to_char
:The documentation describes the available formats.
How about: