dimanche 22 février 2015

How to format Int64 values to currency

i am developing an application, where i save money values in the database as int64.


For example, if i save 1 euro in the database, it gets saved as 100 cents. When I read the value, how can i format it so it gets displayed like this:



db value / output
100000 = 1,000.00
10000 = 100,00
1000 = 10,00
100 = 1,00
10 = 0,10
1 = 0,01


I experimented with string.format but I am unable to get the results i need... Your help will be appreciated, thank you very much.


Aucun commentaire:

Enregistrer un commentaire