{"id":2236,"date":"2010-04-23T14:57:07","date_gmt":"2010-04-23T09:57:07","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=2236"},"modified":"2010-04-23T15:12:32","modified_gmt":"2010-04-23T10:12:32","slug":"how-to-format-a-date-in-visualforce","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2010\/04\/23\/how-to-format-a-date-in-visualforce\/","title":{"rendered":"How to format a date in VisualForce?"},"content":{"rendered":"<p><strong>Problem Statement<\/strong><br \/>\nIn Salesforce, if I&#8217;m binding a date into a VisualForce page, how do I apply custom formatting to it?<\/p>\n<p>Example:<\/p>\n<blockquote><p>&lt;apex :page standardController=&#8221;Contact&#8221;&gt;<br \/>\n&lt;\/apex&gt;&lt;apex :pageBlock title=&#8221;Test&#8221;&gt;<br \/>\n&lt;p&gt;{!contact.Birthdate}&lt;\/p&gt;<br \/>\n&lt;\/apex&gt;<br \/>\n&lt;apex :detail relatedList=&#8221;false&#8221; \/&gt;<\/p><\/blockquote>\n<p>This will output a date in the default format:<\/p>\n<blockquote><p>Thu Jul 01 09:10:23 GMT 2009<\/p><\/blockquote>\n<p>How do I get it (for example) into dd\/mm\/yyyy format, like this:<\/p>\n<blockquote><p>01\/07\/2009<\/p><\/blockquote>\n<p><strong>Solution<\/strong><\/p>\n<blockquote><p>&lt;apex :outputText value=&#8221;{0,date,MM&#8217;\/&#8217;dd&#8217;\/&#8217;yyyy}&#8221;&gt;<br \/>\n&lt;apex :param value=&#8221;{!contact.Birthdate}&#8221; \/&gt;<br \/>\n&lt;\/apex&gt;<\/p><\/blockquote>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;\"><strong>Solution<\/strong><\/div>\n<p>Source : StackOverflow.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem Statement In Salesforce, if I&#8217;m binding a date into a VisualForce page, how do I apply custom formatting to it? Example: &lt;apex :page standardController=&#8221;Contact&#8221;&gt; &lt;\/apex&gt;&lt;apex :pageBlock title=&#8221;Test&#8221;&gt; &lt;p&gt;{!contact.Birthdate}&lt;\/p&gt; &lt;\/apex&gt; &lt;apex :detail relatedList=&#8221;false&#8221; \/&gt; This will output a date in the default format: Thu Jul 01 09:10:23 GMT 2009 How do I get it (for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[169],"class_list":["post-2236","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-salesforce","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=2236"}],"version-history":[{"count":4,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2236\/revisions"}],"predecessor-version":[{"id":2238,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2236\/revisions\/2238"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=2236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=2236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=2236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}