0

I have a problem with the date function in visualforce.

My code looks as following:

<apex:outputText value="{0, date, DD MMMM YYYY}">
                    <apex:param value="{!Opportunity.Invoice_Due_Date__c}" /> </apex:outputText>

Invoice_Due_Date__c is a simple datepicker with no specific rules.

Everytime a date is selected month and year are shown correctly, but day always has numbers higher than 150, which makes absolutly no sense.

Do I have to change the code or the settings of the custom field?

Dennis1995
  • 55
  • 2
  • 8

1 Answers1

0

Visualforce follows Java's "simple date format" rules. <apex:outputText> documentation has example of yyyy.MM.dd rendering to 2004.11.20.

Capital D means day-in-year, 1 to 366 range :)

Pay attention to capital Y too, you want it lowercase. Uppercase one is used in some tricky reporting like if you have factory/warehouse/accounting team insisting new year doesn't always start on January 1st. Sometimes they'll swear to you July started on June 29th ;) Crazy people

eyescream
  • 18,088
  • 2
  • 34
  • 46