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
ahmadkhanahmadkhan 

Formatting Date Error

Hi guys need a lil bit help with date formatting

 

<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!i.Date_of_Incident__c}" />
</apex:outputText>

 

 

this is the code i am using in visual force to format the date but i want to put blank spaces when Date_of_incident__c is empty

but when it ry to do that it gives error that param value expect some numbers please.

 

Please Help!

 

{IF(!i.Date_of_incident)__C!=NULL), display formatted date,'                  '}

Thanks in Advance

crop1645crop1645
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}" rendered="{!NOT(ISBLANK(i.date_of_incident__c)}">
<apex:param value="{!i.Date_of_Incident__c}" />
</apex:outputText>
<apex:outputText value="" rendered="{!ISBLANK(i.date_of_incident__c)}"/>

 Use rendered= attribute to decide when to use outputText formatting