How do I change the number format?
Posted on 2005-05-01
I am using Java to interrogate an Access database. One of the fields is Price. I need price to be displayed in a currency format. At the moment I have it working to display eg "£" 6.0, but I really need to display "£" 6.00.
float price = rs.getFloat("Price");
I have tried using number formatt..which said it wouldnt work with a float..so i changed it to a string....now there are no errors, but when you run it, it doesnt work.
String price = rs.getString("Price");
price = NumberFormat.getCurrencyInstance().format(price);
If i can get this to work, will this only put it into Dollars???