Visualforce Date formatting

I need this date format in a visualforce page: “December 14, 2013”. I can’t seem to find the format options for visualforce. I read that it’s the same as the java messageformat class options, but I cannot find a list for that either.

A little help would be much appreciated

Answer

This will print the date out in the format December 14, 2013. The documentation can be found here

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

or if all you need is the current date printed out in that format then you can use this:

<apex:outputText value="{0, date, MMMM d','  yyyy}">
    <apex:param value="{!NOW()}" />
</apex:outputText>

Have a look at the JavaDocs for SimpleDateFormat for the various date formats. (Thanks to @PeterKnolle for the correct link)

Attribution
Source : Link , Question Author : fourq , Answer Author : BarCotter

Leave a Comment