2

I have this code

<font face="Arial">Invoice Date: 
 <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
  {!line2.Invoice_Date__c}  
 </apex:repeat>
</font>

which outputs the date in the full Salesforce format for a potential string of invoice dates.

I cannot figure out how to modify this code using the outputText Apex code to make the date format more neat (e.g. "MMMM, DD YYYY").

Ideas? Thanks.

2 Answers 2

0

Take a look at the Date Formatting example in the apex:outputText documentation:

<apex:outputText value="{0,date,MMMM' 'dd', 'yyyy}">
  <apex:param value="{!line2.Invoice_Date__c}" />
</apex:outputText>

Note that the entire format string (the MMMM dd yyyy part) isn't quoted, but the text parts (commas, spaces) are. Also note that the link in the salesforce docs to the Java SimpleDataFormat documentation is out of date, current documentation is here.

1
  • Perfect. I had tried a similar code, but hadn't nested within the apex:repeat tag properly. Thank you.
    – user7968
    Apr 18, 2014 at 12:29
0

try something like this:

<apex:outputText value="{0,date,dd'/'MM'/'yyyy}"  >
                <apex:param value="{!line2.Invoice_Date__c}" /> 
</apex:outputText>
1
  • That code definitely works. Thank you for the quick reply.
    – user7968
    Apr 18, 2014 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .