Storing and rendering of Euro curreny values correctly
Storing and rendering of Euro curreny values correctly

Hi,
i want to store Euro currency values correctly in MySQL-DB and render the Euro value correct in DataTable(Editor). My two questions:
- How i store the curreny value in DB -> int or decimal?
- How i render correct with 2 numbers after comma (e.g. 6,50 € | 6.000,50 €)
Best regards
Thomas
This discussion has been closed.
Answers
Hallo Thomas
1. There are many solutions. I always use Decimal(19,4) (it is the most simple and best for scaling and dont loosing money).
2. You could write your own function or use Number.prototype.toFixed e.g.
Best regards
hi @burgard01 ,
This example here may help, it's showing how to show different currency formats, note the line:
Cheers,
Colin
Hi,
thank you for the solution proposals. Now i understand and i have implemented the rendering function successfully!
Best regards
Thomas