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
neeraj1neeraj1 

Need apex code for date out put text in the format "15 mar 2010" in a visual force page.

Hi I need a apex code to display the date in the format  "dd mmm yyyy" ( i.e . 15 mar 2010).

 

right now the fields are in the data type date format . that is standard format. but I need in the above format.

 

Please help . 

 

Thanks.

Ryan-GuestRyan-Guest

How about this:

 

 

<apex:page standardController="contact">
  <apex:outputText value="{0,date,dd MMM yyyy}">
    <apex:param value="{!contact.Birthdate}" /> 
 </apex:outputText>
</apex:page>

 

 

Pradeep_NavatarPradeep_Navatar

Try using format method for date formating in apex :

 

        Datetime dt = system.today();

        string dtFrmt = dt.format('dd MMM yyyy');

        system.debug('$$$$$$$$$$'   + dtFrmt);

 

Hope this helps.

Edward AustinEdward Austin

niicee.. that worked a treat.

 

Thanks