0

So I know I can format dates like

<apex:outputText value="{0, date, MMMM d','  yyyy}">
    <apex:param value="{!contact.Birthdate}" /> 
</apex:outputText>

and this outputs e.g. January 5, 2016.

But what if I want this to show in e.g. Dutch, so that the date would become 5 januari, 2016. Can this be done by changing the above outputText or should I roll my own property on the controller that generates the date for me? In case of the latter, is there a standard library that already does this?

Willem Mulder
  • 3,461
  • 27
  • 51

3 Answers3

1
{! DAY(Contact.BirthDate)}
<apex:outputText value="{!CASE(MONTH(Contact.BirthDate),
                        1, 'Januari',
                        2, 'Februari',
                        3, 'Maart', 
                        4, 'April', 
                        5, 'Mei', 
                        6, 'Juni',
                        7, 'Juli',
                        8, 'Augustus',
                        9, 'September',
                        10, 'Oktober',
                        11, 'November',
                        12, 'December',
                        '-')}" />
{!YEAR(Contact.BirthDate)}  
pranil nimase
  • 401
  • 2
  • 7
  • 16
1

A few years late, but I think ultimately you are not going to find a satisfactory answer to this. Salesforce has not given Visualforce/Apex access to a comprehensive resource for international day/month names.

Your best bet might be to make a reusable Visualforce component. The component can take in a Date or Datetime and have a controller of its own that retrieves day/month maps from some source (Custom Metadata? Labels? Etc) and does the formatting. You'll end up with reusable code you can use in many projects, and then you can include it in VF with a simple tag syntax.

Charles T
  • 10,999
  • 1
  • 26
  • 51
0

Have you tried doing this - may be work

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

Edit :

If not expected result then Go through this - (Talking about Locality)

How to use output text date format to respect locale

Visualforce Component for Locale Based DateTime Display

Salesforce Steps
  • 2,200
  • 4
  • 36
  • 70