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
pclenetpclenet 

Date Format in Force.com Sites

How to display a specific format for a datetime field  on a Site page. I am a newbie in development of Force and Apex so I am not sure to know the best way to do it.

 

My date appear like this

 

Sun Jan 25 23:31:59 GMT 2009 english format however my guest web user local setting are french...

 

Thanks for your help

 

Regards,

 

Pascal

 

Best Answer chosen by Admin (Salesforce Developers) 
aalbertaalbert

Well, you have two options:

1. Wrap the <apex:outputField value="{!Position.CreatedDate}"/>

2. Or you could convert the date/datetime field value into a string within the Apex/Controller. 

 

I recommend option #1. 

All Answers

aalbertaalbert

Can you provide the code snippet that shows how you are displaying the date field? Is the date field bound to a field in the salesforce.com schema?

 

pclenetpclenet

 

 

Hi,

Thanks for your reply

 

Here is the code of my page (it's quite simple and stupid for the moment !) 

 

<p><i><b>{!Position.Location__c}</b> - {!Position.CreatedDate}</i><br/>

 

I tried several things in order to format my date, but nothing worked 

 

Thanks again for your help.

 

 

aalbertaalbert

Well, you have two options:

1. Wrap the <apex:outputField value="{!Position.CreatedDate}"/>

2. Or you could convert the date/datetime field value into a string within the Apex/Controller. 

 

I recommend option #1. 

This was selected as the best answer
pclenetpclenet

Thanks I tried and it's worked, I will see the tutorial of Apex in order to better use the apex tag.

 

JimPDXJimPDX
Could someone post some code samples showing various options for formatting the <apex outputText> value? Thanks.