In This Post I tell You how one can change the date and number format in visual force page by writing a single line of code .
So To Edit the format of date or number in visualforce page we can use outputText attribute
In this post we edit date and number by using output text tag.
Example 1 : Edit Date Format
<apex:outputText value=” {0,date,EEE MMM d, yyyy}”>
<apex:param value=”{!Account.CreatedDate}”/>
</apex:outputText>
we can change the date to other format as well like :
<apex:outputText value=”{0,date,MM’/’dd’/’yyyy}”>
<apex:param value=”{!contact.Birthdate}” />
</apex:outputText>
Example 2 : Edit Number Format
<apex:outputText value=”{0, number,###,###,##0}”>
<apex:param value=”{!account.Services_Cost__c}” />
</apex:outputText>
Output :
700,000,000.00
You can format number to the format you want by just changing the outputText value on the output text tag .
Hits: 809