Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top



Gives me: "Wed Apr 02 00:00:00 GMT 2014"

What would I use if I want:

"Wed Apr 02 2014"

i.e. suppressing the time part.


share|improve this question
up vote 5 down vote accepted

You can use a parameterised outputText with a Java-style format string in your Visualforce page to do this:

<apex:outputText value="{0,date,EEE MMM dd yyyy}">
    <apex:param value="{!relatedTo.K__EndDate__c}" /> 

This is covered in more detail in the documentation here.

Use with nested param tags to format the text values, where {n} corresponds to the n-th nested param tag. The value attribute supports the same syntax as the MessageFormat class in Java. See the MessageFormat class JavaDocs for more information.

share|improve this answer
Is there a locale-respecting way to do this? – Keith C Mar 28 '14 at 11:12
@KeithC You can use .format() in a controller to produce a formatted string in the user's locale. As soon as you start getting into specific formats such as the above it's very hard to respect locale. Salesforce provides short, medium and long date formats, but these are always US localised, despite the documentation suggesting otherwise. This is talked about in this answer (, which seems to infer that this will never be fixed. – Alex Tennant Mar 28 '14 at 11:29
Very helpful - thanks. – Keith C Mar 28 '14 at 11:31
You can also use apex:outputField which respects locale (unlike apex:outputText, but you have no control over the format when you do this, it just uses the default for the user's locale. – Alex Tennant Mar 28 '14 at 11:32
Thanks Alex. That's worked perfectly. – finisterre Mar 28 '14 at 14:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.