I am trying to use a utility method to format the date which is coming as a string. The method is a static method which accepts string as a parameter and returns a formatted date.
Utility.cls
public with sharing class Utility {
public static String FormatDate(String s) {
if(s != null || s!= '') {
String[] dt = s.split('-');
return dt[1]+'-'+dt[2]+'-'+dt[0];
} else {
return '';
}
}
}
Visualforce code:
<apex:page controller="ExportController" contentType="text/csv#{!fileName}.csv"
showHeader="false" sidebar="false" standardStylesheets="false">
"Order #","Document Date","Purchase Order #","Sales Org","Amount","Currency","Products"
<apex:repeat value="{!OpenSalesOrders}" var="oso">
{!oso.OrderNo},"{!Utility.FormatDate(oso.DocumentDate)}","{!oso.PurchaseOrderNo}","{!oso.SalesOrg}","{!oso.Amount}","{!oso.Curren}","{!oso.Product}"
</apex:repeat>
</apex:page>
Issue:
Unknown function Utility.FormatDate. Check spelling.
How to call a static method in an expression in visualforce page? Any ideas?