0

I need this date format in a visualforce page as MM/dd/yy, below is the code. But in page it display as Fri Mar 08 00:00:00 GMT 201903/08/19, Can you please help me on this?

<apex:commandLink value="{!a.Date__c}" action="{!timesheetDetails}" >  
                                <apex:outputText value="{0,date,MM/dd/yy}">
                                    <apex:param value="{!a.Date__c}" />                                         
                                </apex:outputText>
                                <apex:param value="{!a.Id}" name="getsk" assignTo="{!TimesheetDays}"/>
                            </apex:commandLink>
  • Try adding single quotes around the "/" characters in the format definition. – Phil W Mar 25 at 7:22
  • tried, no luck. <apex:outputText value="{0,date,MM'/'dd'/'yy}"> <apex:param value="{!a.Date__c}" /> </apex:outputText> – user3214361 Mar 25 at 8:43
2

You are using the value parameter in apex:commandlink so you're getting the date twice. If you remove it, it should work.

<apex:commandLink action="{!timesheetDetails}" >  
    <apex:outputText value="{0,date,MM/dd/yy}">
        <apex:param value="{!a.Date__c}" />                                         
    </apex:outputText>
    <apex:param value="{!a.Id}" name="getsk" assignTo="{!TimesheetDays}"/>
</apex:commandLink>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.