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
gkappgkapp 

Date time field

Iam trying to render a document as pdf , & created a VF page but when its displaying data on the page its showing date with the time

"Tue Apr 13 00:00:00 GMT 2010"  in this format where as i want it to display just the date . how do i do it 


 

 

Best Answer chosen by Admin (Salesforce Developers) 
SebiSebi

I would format the date you way you want into a string placeholder of some sort and just print that value.

 

 

// controller code

Date theDate = new Date.today();
String theDateString = theDate.format('m-d-Y');


// VF code
{!theDateString}

 

 

All Answers

imuinoimuino

Try doing this on your visualforce page

 

<apex:outputText value="{0,date,d}">

       <apex:param value="{!yourObject.yourDate}" />

</apex:outputText>

SebiSebi

I would format the date you way you want into a string placeholder of some sort and just print that value.

 

 

// controller code

Date theDate = new Date.today();
String theDateString = theDate.format('m-d-Y');


// VF code
{!theDateString}

 

 

This was selected as the best answer
gkappgkapp

Thanks , it worked