+ Start a Discussion

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 . 




How about this:



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




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.