to_char(123456789, '999999999') : to_char « String Functions « PostgreSQL






to_char(123456789, '999999999')

postgres=# SELECT to_char(123456789, '999G999G999D99') AS formatted,
postgres-#        to_char(123456789, '999999999') AS just_digits,
postgres-#        to_char(123456789, '00999999999') AS with_zeroes;
    formatted    | just_digits | with_zeroes
-----------------+-------------+--------------
  123,456,789.00 |  123456789  |  00123456789
(1 row)

postgres=#
postgres=#

           
       








Related examples in the same category

1.to_char: convert number to char
2.to_char(start_date, 'YYYY-MM-DD HH24:MI:SS')
3.to_char(123456789, '999G999G999D99')
4.to_char(123456789, '00999999999')
5.If space is not enough for display
6.to_char(1.0, '9th "Place"')