Visualforce Page:
<apex:page controller=”Sample”>
<apex:pageBlock >
<apex:pageBlockTable value=”{!listAcc}” var=”acc”>
<apex:column value=”{!acc.Name}”/>
<apex:column value=”{!acc.Industry}”/>
<apex:column headerValue=”Created Date Time”>
<apex:outputText value=”{0,date,MM’/’dd’/’yyyy HH:mm}” >
<apex:param value=”{!acc.CreatedDate}”/>
</apex:outputText>
</apex:column>
<apex:column headerValue=”Created Date Only”>
<apex:outputText value=”{0,date,MM’/’dd’/’yyyy}” >
<apex:param value=”{!acc.CreatedDate}”/>
</apex:outputText>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Apex Class:
public class Sample {
public List < Account > listAcc { get; set; }
public Sample() {
listAcc = [ SELECT Id, Name, Industry, CreatedDate FROM Account Limit 10 ];
}
}
Output: