Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Different Date Formats Using Apex and Visualforce

Be First!
by April 4, 2012 APEX, Visual Force
APEX:
public with sharing class clsDateFormat {
Datetime myDateTime = system.now();
  List dateFormats = new List {
     ‘dd.MM.yy HH:mm:ss’,
     ‘MMMMM dd, yyyy hh:mm:ss a’,
     ‘MMM-dd-yyyy hh:mm a’,
     ‘EEEEE dd MMMMM yyyy G’,
     ‘E hh:mm:ss:SSS z’,
     ‘zzzzz (Z), \’Day of the year:\’ D’
  };
   
  public DateTime getMyDateTime(){
    return myDateTime;
  }
  public List getDateFormats(){
    return dateFormats;
  }
}
VisualForce:
 
    
   
    
   
       
           
           
               
                   
               
           
       
   

Demo https://sfdevforce-developer-edition.na12.force.com/DateFormat

(438)

Previous
Next

Leave a Reply