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
RICARDO PALMARICARDO PALMA 

Date format in a Costume Visual Force Page.

Hi,
I'm trying to setup a date format on a date field in a costume visual force page.
Whenever I click save I upsert a list of records saving the date on a date field.
But the field is saving the date on this format : Mon Jun 01 00:00:00 GMT 2015
What I want is save the date on this format: MM'/'dd'/'yyyy.
Here is my code:
<apex:pageBlockTable value="{!ListAllTrackingRec}" var="Prod">
<apex:column >
 <apex:facet name="header">Provisioned <br/>Date </apex:facet>
{!Prod.Provisioned_Date__c }
</apex:column>
</apex:pageBlockTable>

I found a solution on the community but is not working for me. When I use it my date column disappear.
<apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
<apex:param value="{!Prod.Provisioned_Date__c }" />
</apex:outputText>

Thanks.
 
Best Answer chosen by RICARDO PALMA
Arunkumar RArunkumar R
Could you try the below format,

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

All Answers

Arunkumar RArunkumar R
Could you try the below format,

 <apex:outputText value="{0,date,MM/dd/yyyy}">
<apex:param value="{!Prod.Provisioned_Date__c }" />
</apex:outputText>
This was selected as the best answer
RICARDO PALMARICARDO PALMA
Hi Arunkumar,
Thanks for your replay. I tried but is not working, for some reason my column doesn't show up when I using that code.
RICARDO PALMARICARDO PALMA
Hi Arunkumar,
It is working now, I moved a couples thing around.
Here my code.
<apex:column >
 <apex:facet name="header">Provisioned <br/>Date </apex:facet>
<apex:outputText value="{0,date,MM/dd/yyyy}">
<apex:param value="{!Prod.Provisioned_Date__c }" />
</apex:outputText>
</apex:column>
RICARDO PALMARICARDO PALMA
Thanks again !!!!
Arunkumar RArunkumar R
Hi Ricardo,

I just test using simple query,
 
public class OppClass
{
    public list<opportunity> oppList{get; set;}
    
    public vv()
    {
        oppList = [select closedate from opportunity];
    }
}
 
<apex:page controller="OppClass">
<apex:pageBlock >
<apex:pageBlockTable value="{!oppList}" var="opp">
<apex:column >
 <apex:facet name="header">Provisioned <br/>Date </apex:facet>
 <apex:outputText value="{0,date,MM/dd/yyyy}">
<apex:param value="{!opp.CloseDate}" />
</apex:outputText>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Is Provisioned_Date__c is Date right? Could you simply try like above based on your object?