Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Salesforce by (11.9k points)

In Salesforce, if I'm binding a date into a VisualForce page, how do I apply custom formatting to it?

Example:

<apex:page standardController="Contact">

  <apex:pageBlock title="Test">

      <p>{!contact.Birthdate}</p>

  </apex:pageBlock>                   

  <apex:detail relatedList="false" />

</apex:page>

This will output a date in the default format:

Thu Jul 01 09:10:23 GMT 2009

How do I get it (for example) into dd/mm/yyyy format, like this:

01/07/2009

(Hopefully, this is a fairly easy question, but to get the Salesforce community going on here I figure we need a few easy questions.) 

1 Answer

+2 votes
by (32.1k points)
edited by

To format a date in Visual Force, in dd/mm/yyyy format, try the following code:

Want to learn Salesforce from basics! Here's the right video for you on Salesforce provided by Intellipaat:

<apex:outputField value = "{!invitation.Account_group__r.Submission_Due_Date__c}"/>

Related questions

0 votes
1 answer
0 votes
1 answer
asked Aug 13, 2019 in Web Technology by Sammy (47.6k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers

500 comments

108k users

Browse Categories

...