function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HanSoloHanSolo 

I created a Date field that is showing as Mon Jul 22 00:00:00 GMT 2019 in a visual force page but want it to show as 7/22/2019

Hello,

I created a Date Field in custom object TiFF1040 and named the Date field, Date Director of Sales Approved TiFF. The date renders perfectly in a regular lightning page, however, when I place the following string in Visualforce, it produces this output: Mon Jul 22 00:00:00 GMT 2019

However, I need it to show as 7/22/2019.

Any help is appreciated.

Thank you!

 
{!TiFF1040__c.Date_Director_of_Sales_Approved_TiFF__c}

 
Best Answer chosen by HanSolo
ApuroopApuroop
If you can use the <apex:outputText> tag then the following should work:
 
<apex:outputText value="{0, date,MM'/'dd'/'yyyy}">
   <apex:param value="{!TiFF1040__c.Date_Director_of_Sales_Approved_TiFF__c}"/>
</apex:outputText>
Reference: https://salesforce.stackexchange.com/questions/22321/visualforce-date-formatting

All Answers

ApuroopApuroop
If you can use the <apex:outputText> tag then the following should work:
 
<apex:outputText value="{0, date,MM'/'dd'/'yyyy}">
   <apex:param value="{!TiFF1040__c.Date_Director_of_Sales_Approved_TiFF__c}"/>
</apex:outputText>
Reference: https://salesforce.stackexchange.com/questions/22321/visualforce-date-formatting
This was selected as the best answer
HanSoloHanSolo
Thank you!!