Skip to content
Advertisement

convert number with decimals without

I make a query to mysql and I get this number:

26,613,080

and I need to convert that number to:

266,130 or 266.130 (it does not matter if it is , or . )

I was doing some tests with number format or removing the last 2 numbers but I can’t get it to stay as I need.

Thanks

Advertisement

Answer

If you have the intl extension installed, you can use the NumberFormatter class for this.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement