Problem: How to format output text field value on VF page and also number formatting?
Description: In a situation I have date field on the vf page which is binded to date field having value in format “Thu Dec 1 07:00:11 GMT 2016”. But I want to display it in this format “12/01/13”. So instead of changing the field value you can format the output field on vf page.
Solution: In Apex Controller:
String datevalue=’Thu Dec 1 07:00:11 GMT 2016’; Integer numberValue=789.189;
On VF Page:
1. Format Date Field:
Format Output {0, date, short} 12/01/16 {0, date, medium} Dec 01, 2016 {0, date, long} December 01, 2016 {0, date, full} Thursday, December 01, 2016 {0, date, yyyy-mm-dd hh:mm:ss a} 2016-Dec-01 07:00:11 AM GMT
2. Format Number Field:
Format Output {0, number, integer} 789 {0, number, currency} $789.189 {0, number, 0000.0} 0789.1 {0, number, ####.#} 789.1 {0, number, 0.0000} 789.1890 {0, number, #.####} 789.189