October 21, 2013

How to remove time from date in Visualforce page?

Sample Code:

Visualforce page:


  1. <apex:page controller="Sample" >    
  2.     
  3.     <apex:form >            
  4.     
  5.          <apex:outputText value="{0,date,dd'/'MM'/'yyyy}" >    
  6.              <apex:param value="{!temp}"/>    
  7.          </apex:outputText>    
  8.     
  9.     </apex:form>    
  10.     
  11. </apex:page>     

Apex Controller:


  1. public with Sharing class Sample {       
  2.     
  3.     public Date gettemp() {    
  4.         Date d = date.ValueOf('2013-12-10');    
  5.         return d;    
  6.     }    
  7.               
  8.     public sample() {}    
  9.      
  10. }    

Output:


No comments:

Post a Comment