+ Start a Discussion
SL TanSL Tan 

Re:Date Problem in Visual Force

I have following coding in my Visualforce Page, it is supposed to output the date using Date Data Type:

<apex:outputText value="Contract Date:" style="font-weight:bold"/>

<apex:outputText value="{!Greige_Order__c.Contract_Date__c}"/>

 

The output shows Day, Date and Time instead of the normal format of 23/04/2009-

 

Contract Date:              Wed Apr 23 00:00:00 GMT 2008

 

I have another coding on the same VF page also using the Date Data Type for the First_Del_Mth__c field:

<apex:outputText value="{!New_Order__c.First_Del_Mth__c} "/>

The output is as follows, which is what is needed:


31/05/2008

 

Does anyone has the same problem and if so, how could this be solved?.

Any pointer will be highly appreciated

Many thanks in advance 

SL

Best Answer chosen by Admin (Salesforce Developers) 
Venkat PolisettVenkat Polisett

 

Try standard component outputField instead of outputText.

 

 

All Answers

Venkat PolisettVenkat Polisett

 

Try standard component outputField instead of outputText.

 

 

This was selected as the best answer
mavsmavs

{!DAY(Greige_Order__c.Contract_Date__c)}/{!MONTH(Greige_Order__c.Contract_Date__c)}/{!YEAR(Greige_Order__c.Contract_Date__c)}

Try this....

SL TanSL Tan

Dear Venkat Polisetti,

Thank you very much for your kind and quick reply. This works perfectly. 

I appreciate very much your help

Thanks and Best Regards

SL

SL TanSL Tan

Dear Mavs

Thanks for your kind reply. I have been able to solve the problem using Outputfield as suggested by Mr.  Venkat Polisett's posting. Appreciate your suggestion too!

Thanks and Best Regards

SL

angusgrantangusgrant

Hi can I ask a question relating to mavs thread is it possible to also possible to split the time element of a date/time string. For example i tried this but it does not work for me but the date element can be extracted.

 

{!HOUR(SBS_Event__c.Event_Start_date__c)}

{!MINUTE(SBS_Event__c.Event_Start_date__c)} 

 

many thanks for your help.

 

 

SL TanSL Tan

Hi Angusgrant

I try to test on my coding above using OutputText and upon save, I got the following error message -  "Unknown function HOUR. Check spelling. "

Has anyone else tried?

Best Regards

SL