Newer Version Available
FORMAT ()
Use FORMAT with the SELECT clause to apply localized formatting to standard and custom number, date, time,
and currency fields.
When the FORMAT function is applied these fields reflect the appropriate format for the given user locale. The field format matches what appears in the Salesforce Classic user interface. For example, the date December 28, 2015 can appear numerically as 2015-12-28, 28-12-2015, 28/12/2015, 12/28/2015, or 28.12.2015, depending on the org’s locale setting.
This example is for an org that has multiple currencies
enabled.
1SELECT FORMAT(amount) Amt, format(lastModifiedDate) editDate FROM Opportunity
2editDate = "7/2/2015 3:11 AM"
3Amt = "AED 1,500.000000 (USD 1,000.00)"The FORMAT function supports aliasing. You can also nest
it with aggregate or convertCurrency() functions. For
example:
1SELECT amount, FORMAT(amount) Amt, convertCurrency(amount) editDate, FORMAT(convertCurrency(amount)) convertedCurrency FROM Opportunity where id = '12345'
2SELECT FORMAT(MIN(closedate)) Amt FROM opportunity